1
因此,我正在爲窗口打開動畫,並且該動畫看起來非常適合我要做的事情,除了一個關鍵部分...窗口和之間的空間和它目前在動畫中是黑匣子。動畫WPF的黑匣子
我google了很多,但我沒有看到這個問題提到任何地方!
我已經在標準窗口中嘗試過這一點,除了黑盒子之外沒有其他區別只顯示在窗口邊框內。除了Visual Studio爲我生成的任何內容之外,我沒有任何代碼隱藏。
這裏是我的窗口:
<Controls:MetroWindow x:Class="Schedule.MainWindow"
xmlns:Controls="clr-namespace:MahApps.Metro.Controls;assembly=MahApps.Metro"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Name="mainWindow"
Title="MainWindow" Height="350" Width="525" WindowStartupLocation="CenterScreen">
<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 Source="pack://application:,,,/MahApps.Metro;component/Styles/Accents/Blue.xaml" />
<ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Accents/BaseLight.xaml" />
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</Window.Resources>
<Window.RenderTransform>
<ScaleTransform ScaleX="1" ScaleY="1" x:Name="winTransform1"/>
</Window.RenderTransform>
<Window.RenderTransformOrigin>
<Point X=".5" Y=".5"/>
</Window.RenderTransformOrigin>
<Window.Triggers>
<EventTrigger SourceName="mainWindow" RoutedEvent="Window.Loaded">
<BeginStoryboard Name="openBoard">
<Storyboard>
<DoubleAnimation Storyboard.TargetName="winTransform1" Storyboard.TargetProperty="ScaleX"
From="0" To="1" Duration="0:0:1"/>
</Storyboard>
</BeginStoryboard>
</EventTrigger>
</Window.Triggers>
<Grid>
</Grid>
你太棒了!另外,我很方便地將它轉換爲使用WPF的Modern UI,並且即使在WindowStyle爲None時,它也會繼續處理窗口邊框。 – malexdev