Skip to content

Commit

Permalink
Add animations example for buttons
Browse files Browse the repository at this point in the history
  • Loading branch information
SergeyNefyodov committed Nov 28, 2024
1 parent 4faf2d8 commit 4725628
Show file tree
Hide file tree
Showing 3 changed files with 96 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ private void SelectElement()
_element = Context.Document.GetElement(reference);
CollectValues();
RaiseShowRequest();

var color = System.Windows.Media.Colors.Green;
}

[RelayCommand]
Expand Down
83 changes: 83 additions & 0 deletions source/ExtensibleStorageExample/Views/Dictionary.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,87 @@
</DataTemplate>

<views:DataGridCellSelector x:Key="DataGridCellSelector" />



<Style
TargetType="Button"
x:Key="TrigerredButtonStyle">
<Style.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Trigger.Setters>
<Setter Property="BorderThickness" Value="3"/>
<Setter Property="RenderTransform">
<Setter.Value>
<ScaleTransform ScaleX="1.05" ScaleY="1.05" />
</Setter.Value>
</Setter>
</Trigger.Setters>
</Trigger>
<Trigger Property="IsMouseOver" Value="False">
<Trigger.Setters>
<Setter Property="BorderThickness" Value="1"/>
<Setter Property="RenderTransform">
<Setter.Value>
<ScaleTransform ScaleX="1" ScaleY="1" />
</Setter.Value>
</Setter>
</Trigger.Setters>
</Trigger>
</Style.Triggers>
</Style>

<Style
TargetType="Button"
x:Key="AnimatedButtonStyle">
<Setter Property="BorderThickness" Value="1"/>
<Setter Property="RenderTransform">
<Setter.Value>
<ScaleTransform ScaleX="1" ScaleY="1" />
</Setter.Value>
</Setter>

<Style.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Trigger.EnterActions>
<BeginStoryboard>
<Storyboard>
<DoubleAnimation
Storyboard.TargetProperty="RenderTransform.(ScaleTransform.ScaleX)"
To="1.05"
Duration="0:0:0.5" />
<DoubleAnimation
Storyboard.TargetProperty="RenderTransform.(ScaleTransform.ScaleY)"
To="1.05"
Duration="0:0:0.5" />
<ThicknessAnimation
Storyboard.TargetProperty="BorderThickness"
To="3"
Duration="0:0:0.5" />
</Storyboard>
</BeginStoryboard>
</Trigger.EnterActions>
<Trigger.ExitActions>
<BeginStoryboard>
<Storyboard>
<DoubleAnimation
Storyboard.TargetProperty="RenderTransform.(ScaleTransform.ScaleX)"
To="1"
Duration="0:0:0.5" />
<DoubleAnimation
Storyboard.TargetProperty="RenderTransform.(ScaleTransform.ScaleY)"
To="1"
Duration="0:0:0.5" />
<ThicknessAnimation
Storyboard.TargetProperty="BorderThickness"
To="1"
Duration="0:0:0.5" />
</Storyboard>
</BeginStoryboard>
</Trigger.ExitActions>
</Trigger>
</Style.Triggers>
</Style>


</ResourceDictionary>
14 changes: 11 additions & 3 deletions source/ExtensibleStorageExample/Views/SchemaViewerView.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -50,15 +50,23 @@
</DataGrid.Columns>
</DataGrid>
<Button
Margin="5"
Margin="10"
Padding="5"
HorizontalAlignment="Center"
Content="Select another element"
Command="{Binding SelectElementCommand}"/>
<Button
Margin="5"
Style="{StaticResource TrigerredButtonStyle}"
Margin="10"
Padding="5"
HorizontalAlignment="Center"
Content="Create new schema"
Command="{Binding CreateNewSchemaCommand}"/>
<Button
Margin="5"
Style="{StaticResource AnimatedButtonStyle}"
Margin="10"
Padding="5"
HorizontalAlignment="Center"
Content="Save data"
Command="{Binding SaveDataCommand}"/>
</StackPanel>
Expand Down

0 comments on commit 4725628

Please sign in to comment.