【发布时间】:2016-03-30 12:40:58
【问题描述】:
我正在开发我的第一个使用 Prism 6 的 WPF 应用程序。 单击按钮时,应该会启动大约需要 1-2 分钟的操作。
我想在窗口内所有其他控件之上显示一个半透明层,并显示操作进度和一个取消按钮,如下图和代码所示
<Window x:Class="TestingApplication.Shell"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:prism="http://www.codeplex.com/prism">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<Border Grid.Column="0">
<ContentControl x:Name="NavigationItemsControl"
prism:RegionManager.RegionName="MainNavigationRegion"
Grid.Column="0"/>
</Border>
<ContentControl prism:RegionManager.RegionName="MainContentRegion"
Grid.Row="1"/>
<Grid Grid.RowSpan="2" Background="#5555">
<Border BorderBrush="Gray" BorderThickness="1"
Width="400" Height="200" Background="White">
<StackPanel Margin="10">
<TextBlock Text="Loading... Please wait"
Margin="0,10" FontSize="18"/>
<ProgressBar HorizontalAlignment="Stretch" Height="40"/>
<Button Content="Cancel" HorizontalAlignment="Center"
Margin="0,10"/>
</StackPanel>
</Border>
</Grid>
</Grid>
</Window>
您能否给我任何建议,这将是实现这一点并同时利用 Prism 和 MVVM 的最佳实践?
谢谢你, 娜迪亚
【问题讨论】:
-
我很困惑,你是什么意思。你能解释一下,这是你需要的吗:单击按钮时,应该会出现一些灰色布局,直到过程完成?
-
是的,这正是我所需要的