我已经创建了metro应用程序,我已经为我的视图创建了视图基础
public class ViewBase : Page,IView
{
public object Parameter { get; private set; }
private ProgressBar _progressRing;
public ViewBase()
{
Parameter = null;
_progressRing = new ProgressBar
{
IsIndeterminate = true,
Height = 25,
Width = 100,
FlowDirection = FlowDirection.LeftToRight,
Foreground = new SolidColorBrush(Colors.Blue),
HorizontalAlignment = HorizontalAlignment.Center,
VerticalAlignment = VerticalAlignment.Top,
Margin = new Thickness(0,12,0,0)
};
}
public ViewBase(object parameter)
{
Parameter = parameter;
_progressRing = new ProgressBar
{
IsIndeterminate = true,
Height = 25,
Width = 100,
FlowDirection = FlowDirection.LeftToRight,
Foreground = new SolidColorBrush(Colors.Blue),
HorizontalAlignment = HorizontalAlignment.Center,
VerticalAlignment = VerticalAlignment.Top,
Margin = new Thickness(0, 12, 0, 0)
};
}
#region Properties
public virtual string Title
{
get { return ""; }
}
#endregion
#region IView
public async void DisplayMessage(MessageHandler handler)
{
await MessageBoxHelper.ShowAsync(handler);
}
public void SetAsBusy()
{
_progressRing.Visibility = Visibility.Visible;
Frame.IsEnabled = false;
}
public void SetAsIdle()
{
_progressRing.Visibility=Visibility.Collapsed;
Frame.IsEnabled = true;
}
#endregion
}
}
所以现在我需要的是每当我的观看电话SetAsBusy()
时,我需要展示我的progressBar
。但似乎我无法添加它。 WinRT API不存在Frame.AddChild()
。那我该怎么做?我可以在我的所有视图中手动添加进度条,但它会得到太多
答案 0 :(得分:0)
“这意味着我需要在我的所有视图中添加它?我需要在我的视图库中执行此操作,因此我不会重新创建所有的ProgressBar”
默认是的。你可以做的是在你的常规框架周围有一个“shell”页面,而不是设置你的导航与那个内框架交互。