当Storyboard关闭窗口“This Visual is not connected to a PresentationSource”时,我得到了这个错误。
我的场景包括两个窗口和一个 UserControl
这是window1的xaml代码:
<Window x:Name="LWindow" x:Class="WpfAppXtesting.WindowTest1"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:WpfAppXtesting"
mc:Ignorable="d"
WindowStyle="None"
Title="WindowTest1" Height="160" Width="435">
<Window.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
</ResourceDictionary.MergedDictionaries>
<!-- Storyboard -->
<Storyboard x:Key="OpenLWindow">
<DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(FrameworkElement.Width)" Storyboard.TargetName="LWindow">
<EasingDoubleKeyFrame KeyTime="0" Value="0"/>
<EasingDoubleKeyFrame KeyTime="0:0:0.5" Value="434.4"/>
</DoubleAnimationUsingKeyFrames>
<DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(FrameworkElement.Height)" Storyboard.TargetName="LWindow">
<EasingDoubleKeyFrame KeyTime="0" Value="37"/>
<EasingDoubleKeyFrame KeyTime="0:0:0.5" Value="37"/>
<EasingDoubleKeyFrame KeyTime="0:0:1" Value="159.8"/>
</DoubleAnimationUsingKeyFrames>
</Storyboard>
杨__羊羊
相关分类