SystemTray for Pivot Item content

孤街浪徒 提交于 2020-01-17 05:17:25

问题


I have a Pivot Control in MainPage.xaml page. I add in the PageOne.xaml.cs as pivot item using

private void OnLoadingPivotItem(object sender, PivotItemEventArgs e)
{
if (e.Item.Content != null)
{
    // Content loaded already
    return;
}

Pivot pivot = (Pivot)sender;

if (e.Item == pivot.Items[0])
{
    e.Item.Content = new PageOne();
}
}

Thing is not working so fine, but I have tried to fix them, for example,

    // NavigationService.Navigation(new Uri());
    // need to change to
    (App.Current as App).RootFrame.Navigate( new Uri());

// ApplicationBar for PivotItem
appBar = ((PhoneApplicationPage)((PhoneApplicationFrame)Application.Current.RootVisual).Content).ApplicationBar;

Now, I need to show ProgressIndicator on my PivotControl MainPage.xaml from my PageOne.xaml.cs code.

_progressIndicator = new ProgressIndicator
            {
                IsIndeterminate = true,
                IsVisible = false,
            };

            SystemTray.SetProgressIndicator(this, _progressIndicator);

But progressIndicator doesn't show, what should I do? My guess is to call the SystemTray of RootFrame but I am not sure how to.


回答1:


Try change the property IsVisible to true.

Wish this can help you.




回答2:


I need to pass MainPage as reference to PageOne, and put it as parameter when using SystemTray.SetProgressIndicator.

In MainPage.xaml.cs

e.Item.Content = new PageOne(this);

Here is the constructor code from PageOne.xaml.cs

public PageOne(MainPage page) {
_progressIndicator = new ProgressIndicator
            {
                IsIndeterminate = true,
                IsVisible = false,
            };
SystemTray.SetProgressIndicator(page, _progressIndicator);
}


来源:https://stackoverflow.com/questions/22745852/systemtray-for-pivot-item-content

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!