我是WPF的新手。 我尝试在打开窗口时更改窗口的大小和位置。 但它不起作用。只有4个属性中的3个增长(按写作顺序排在前3位)。 附加代码:
<Window x:Class="Client.X64.TestWindow"
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:Client.X64"
mc:Ignorable="d"
Title="TestWindow" Height="Auto" Width="Auto" x:Name="Test" WindowStyle="None" AllowsTransparency="True" Background="Transparent">
<Window.Triggers>
<EventTrigger RoutedEvent="Window.Loaded">
<BeginStoryboard>
<Storyboard x:Name="WindowMoveSB">
<DoubleAnimation x:Name="AnimationMoveWindowLeft" Duration="0:0:5.0" Storyboard.TargetProperty="(Window.Left)" Storyboard.TargetName="Test" From="20" To="200"/>
<DoubleAnimation x:Name="AnimationMoveWindowTop" Duration="0:0:5.0" Storyboard.TargetProperty="(Window.Top)" Storyboard.TargetName="Test" From="20" To="200"/>
<DoubleAnimation x:Name="AnimationMoveWindowHeight" Duration="0:0:5.0" Storyboard.TargetProperty="Height" Storyboard.TargetName="Test" From="20" To="400"/>
<DoubleAnimation x:Name="AnimationMoveWindowWidth" Duration="0:0:5.0" Storyboard.TargetProperty="Width" Storyboard.TargetName="Test" From="20" To="400"/>
</Storyboard>
</BeginStoryboard>
</EventTrigger>
</Window.Triggers>
<Grid x:Name="TestGrid" Background="{DynamicResource {x:Static SystemColors.ActiveCaptionBrushKey}}" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" MouseRightButtonDown="TestGrid_MouseRightButtonDown" MouseLeftButtonDown="TestGrid_MouseLeftButtonDown">
</Grid>
</Window>
我会批评一个回应 Shlomy