我在我的WPF应用程序中使用MahApps.Metro UI。这是一个很好的,满足我的需求,但如果有人告诉我如何在弹出时禁用Windows动画,我会更高兴。
当我调用Show()方法时,弹出新窗口,我看到一个恼人的动画(内容从右向左滑动)。效果类似于下图所示的另一个效果(但它显示标签和内容从左到右):
虚拟表格的样本请参见下文:
<controls:MetroWindow x:Class="TestProj.Views.TestView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:controls="clr-namespace:MahApps.Metro.Controls;assembly=MahApps.Metro"
xmlns:vm="clr-namespace:TestProj.ViewsModels"
Height="230" Width="550">
<Window.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Colours.xaml" />
<ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Fonts.xaml" />
<ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Controls.xaml" />
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</Window.Resources>
<Grid>
</Grid>
</controls:MetroWindow>
正如在等效的GitHUb问题上所讨论的,默认情况下MetroWindow
控件模板将使用MetroContentControl
(具有此动画)。
您需要编辑模板以将其更改回ContentControl
。
示例代码here
在窗口的xaml中设置WindowTransitionsEnabled="False"
。