我正在将一个基于 MVVM 的 WP8 应用程序转换为 Caliburn Micro,我对它是全新的(对 XAML/WP8 也很绿色)
我对如何将 SystemTray 之类的东西绑定到我的视图的 ViewModel 感到困惑。在 Caliburn Micro 之前,我的观点看起来像
<UserControl.Resources>
<viewModels:SomeViewModel x:Key="viewModel" />
</UserControl.Resources>
<shell:SystemTray.ProgressIndicator>
<shell:ProgressIndicator IsVisible="{Binding Path=IsLoading, Source={StaticResource viewModel}}" />
</shell:SystemTray.ProgressIndicator>
这非常有效,并且会在 ViewModel 加载时显示加载指示器。现在我的 ViewModel 不再是视图中的 StaticResource,如何将绑定放到 SystemTray 中?
我最初的刺失败:
<shell:ProgressIndicator IsVisible="{Binding ElementName=LayoutRoot, Path=DataContext.IsLoading" />
我觉得我需要将视图模型拉出来,LayoutRoot
但我不确定该怎么做。