I would like the width of the element to decrease at the click of a button.
Now I have two objects basically, when you press the button on object A, the storyboard starts, which rotates it around the x axis and collapses it. Then he shows the object B, setting the visibility visible and turning it into the field of view.
All I want to add is to set the width smaller while the storyboard happens to objects A and objectB, and then return to normal at the end of the storyboard.
I tried to set the thickness, but I had a compile-time error complaining that it had just been read.
<ObjectAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="objectA" Storyboard.TargetProperty="(UIElement.Margin)"> <DiscreteObjectKeyFrame KeyTime="00:00:00"> <DiscreteObjectKeyFrame.Value> <Thickness Left="10" Right="10"/> </DiscreteObjectKeyFrame.Value> </DiscreteObjectKeyFrame> </ObjectAnimationUsingKeyFrames>
I now have a simple layout ...
Here is my XAML UI:
<StackPanel> <Border x:Name="objectA" BorderBrush="Blue" BorderThickness="1" Height="100" Width="100"> <StackPanel> <TextBox Margin="10"></TextBox> <Button Width="50" x:Name="btn1" Content="Flip" Click="btn1_Click"/> </StackPanel> <Border.Projection> <PlaneProjection RotationX="0"></PlaneProjection> </Border.Projection> </Border> <Border Visibility="Collapsed" x:Name="objectB" BorderBrush="Red" BorderThickness="1" Height="100" Width="100"> <StackPanel> <TextBox Margin="10"></TextBox> <Button Width="50" x:Name="btn2" Content="Flip" Click="btn2_Click"/> </StackPanel> <Border.Projection> <PlaneProjection RotationX="90"></PlaneProjection> </Border.Projection> </Border>
Here is the storyboard ...
<Storyboard x:Name="Storyboardtest"> <DoubleAnimation BeginTime="00:00:00" Storyboard.TargetName="objectA" Storyboard.TargetProperty="(UIElement.Projection).(RotationX)" From="0" To="-90"> </DoubleAnimation> <ObjectAnimationUsingKeyFrames BeginTime="00:00:01" Storyboard.TargetName="objectA" Storyboard.TargetProperty="(UIElement.Visibility)"> <DiscreteObjectKeyFrame KeyTime="00:00:00"> <DiscreteObjectKeyFrame.Value> <Visibility>Collapsed</Visibility> </DiscreteObjectKeyFrame.Value> </DiscreteObjectKeyFrame> </ObjectAnimationUsingKeyFrames> <ObjectAnimationUsingKeyFrames BeginTime="00:00:01" Storyboard.TargetName="objectB" Storyboard.TargetProperty="(UIElement.Visibility)"> <DiscreteObjectKeyFrame KeyTime="00:00:00"> <DiscreteObjectKeyFrame.Value> <Visibility>Visible</Visibility> </DiscreteObjectKeyFrame.Value> </DiscreteObjectKeyFrame> </ObjectAnimationUsingKeyFrames> <DoubleAnimation BeginTime="00:00:01" Storyboard.TargetName="objectB" Storyboard.TargetProperty="(UIElement.Projection).(RotationX)" From="90" To="0"> </DoubleAnimation> </Storyboard>
source share