Last active
January 30, 2020 18:02
-
-
Save s-fernandez-v/6c11a2c28d8b0ee2872e3551d0757c1b to your computer and use it in GitHub Desktop.
RepeatButton: Delay and Interval
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<Grid | |
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" | |
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"> | |
<Grid HorizontalAlignment="Center" VerticalAlignment="Center"> | |
<Grid.ColumnDefinitions> | |
<ColumnDefinition/> | |
<ColumnDefinition Width="Auto"/> | |
</Grid.ColumnDefinitions> | |
<Grid.RowDefinitions> | |
<RowDefinition/> | |
<RowDefinition Height="Auto"/> | |
</Grid.RowDefinitions> | |
<StackPanel Grid.Row="0"> | |
<StackPanel.Triggers> | |
<EventTrigger RoutedEvent="ButtonBase.Click"> | |
<BeginStoryboard> | |
<Storyboard> | |
<ColorAnimation Duration="0:0:0.3" Storyboard.TargetName="Rect2" Storyboard.TargetProperty="Fill.Color" From="#00ADFF2F" To="#FFADFF2F"/> | |
</Storyboard> | |
</BeginStoryboard> | |
</EventTrigger> | |
</StackPanel.Triggers> | |
<Grid> | |
<Grid.ColumnDefinitions> | |
<ColumnDefinition/> | |
<ColumnDefinition Width="50"/> | |
</Grid.ColumnDefinitions> | |
<RepeatButton x:Name="Button4" Content="Repeat Button" VerticalAlignment="Center" Padding="32,8" Interval="{Binding Value, ElementName=Interval}" Delay="{Binding Value, ElementName=Delay}"/> | |
<TextBlock Grid.Column="1" Text="{Binding IsPressed, ElementName=Button4}" VerticalAlignment="Center" Margin="8,0,0,0"/> | |
</Grid> | |
</StackPanel> | |
<Grid Grid.Column="1" Grid.Row="0" Margin="8,0,0,0" UseLayoutRounding="True" Background="Lime"> | |
<Rectangle Fill="DodgerBlue" Width="40"/> | |
<Rectangle Fill="#FFADFF2F" Width="40" x:Name="Rect2"/> | |
</Grid> | |
<Grid Grid.Row="1" Margin="0,16,0,0" Grid.ColumnSpan="2"> | |
<Grid.ColumnDefinitions> | |
<ColumnDefinition Width="Auto"/> | |
<ColumnDefinition Width="*"/> | |
<ColumnDefinition Width="40"/> | |
</Grid.ColumnDefinitions> | |
<StackPanel Grid.Column="0"> | |
<Border Height="{Binding ActualHeight, ElementName=Delay}"> | |
<TextBlock Text="Delay: " VerticalAlignment="Center"/> | |
</Border> | |
<Border Height="{Binding ActualHeight, ElementName=Interval}" Margin="0,4,0,0"> | |
<TextBlock Text="Interval: " VerticalAlignment="Center"/> | |
</Border> | |
</StackPanel> | |
<StackPanel Grid.Column="1" Margin="0,0,16,0" VerticalAlignment="Top"> | |
<Slider x:Name="Delay" Maximum="500" SmallChange="10" LargeChange="100" Value="400"/> | |
<Slider x:Name="Interval" Margin="0,4,0,0" Minimum="5" Maximum="500" LargeChange="100" SmallChange="10" Value="250"/> | |
</StackPanel> | |
<StackPanel Grid.Column="2"> | |
<Border HorizontalAlignment="Right" Height="{Binding ActualHeight, ElementName=Delay}"> | |
<TextBlock Text="{Binding Value, ElementName=Delay, StringFormat=F1}" VerticalAlignment="Center"/> | |
</Border> | |
<Border HorizontalAlignment="Right" Height="{Binding ActualHeight, ElementName=Interval}" Margin="0,4,0,0"> | |
<TextBlock Text="{Binding Value, ElementName=Interval, StringFormat=F1}" VerticalAlignment="Center"/> | |
</Border> | |
</StackPanel> | |
</Grid> | |
</Grid> | |
</Grid> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment