Created
June 18, 2018 08:26
-
-
Save sonnemaf/c25b6cc6af2a744277d835332b3cb177 to your computer and use it in GitHub Desktop.
UnderlinedRadioButtonStyle
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
<Page x:Class="App34.MainPage" | |
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" | |
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | |
xmlns:local="using:App34" | |
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" | |
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" | |
mc:Ignorable="d" | |
RequestedTheme="Dark" | |
Background="{ThemeResource ApplicationPageBackgroundThemeBrush}"> | |
<Page.Resources> | |
<Style x:Key="UnderlinedRadioButtonStyle" | |
TargetType="RadioButton"> | |
<Setter Property="Background" | |
Value="Transparent" /> | |
<Setter Property="Foreground" | |
Value="{ThemeResource RadioButtonForeground}" /> | |
<Setter Property="BorderBrush" | |
Value="{ThemeResource SystemAccentColor}" /> | |
<Setter Property="HorizontalAlignment" | |
Value="Stretch" /> | |
<Setter Property="VerticalAlignment" | |
Value="Stretch" /> | |
<Setter Property="HorizontalContentAlignment" | |
Value="Center" /> | |
<Setter Property="VerticalContentAlignment" | |
Value="Center" /> | |
<Setter Property="FontFamily" | |
Value="{ThemeResource ContentControlThemeFontFamily}" /> | |
<Setter Property="FontSize" | |
Value="{ThemeResource ControlContentThemeFontSize}" /> | |
<Setter Property="MinWidth" | |
Value="120" /> | |
<Setter Property="UseSystemFocusVisuals" | |
Value="{StaticResource UseSystemFocusVisuals}" /> | |
<Setter Property="FocusVisualMargin" | |
Value="0,0,0,-2" /> | |
<Setter Property="Template"> | |
<Setter.Value> | |
<ControlTemplate TargetType="RadioButton"> | |
<Grid x:Name="RootGrid" | |
Background="{TemplateBinding Background}"> | |
<Grid.RowDefinitions> | |
<RowDefinition Height="*" /> | |
<RowDefinition Height="2" /> | |
</Grid.RowDefinitions> | |
<VisualStateManager.VisualStateGroups> | |
<VisualStateGroup x:Name="CommonStates"> | |
<VisualState x:Name="Normal" /> | |
<VisualState x:Name="PointerOver"> | |
<Storyboard> | |
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="ContentPresenter" | |
Storyboard.TargetProperty="Foreground"> | |
<DiscreteObjectKeyFrame KeyTime="0" | |
Value="{ThemeResource RadioButtonPointerOverBorderThemeBrush}" /> | |
</ObjectAnimationUsingKeyFrames> | |
</Storyboard> | |
</VisualState> | |
<VisualState x:Name="Pressed"> | |
<Storyboard> | |
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="ContentPresenter" | |
Storyboard.TargetProperty="Foreground"> | |
<DiscreteObjectKeyFrame KeyTime="0" | |
Value="{ThemeResource RadioButtonPointerOverBorderThemeBrush}" /> | |
</ObjectAnimationUsingKeyFrames> | |
</Storyboard> | |
</VisualState> | |
<VisualState x:Name="Disabled"> | |
<Storyboard> | |
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="ContentPresenter" | |
Storyboard.TargetProperty="Foreground"> | |
<DiscreteObjectKeyFrame KeyTime="0" | |
Value="{ThemeResource RadioButtonForegroundDisabled}" /> | |
</ObjectAnimationUsingKeyFrames> | |
</Storyboard> | |
</VisualState> | |
</VisualStateGroup> | |
<VisualStateGroup x:Name="CheckStates"> | |
<VisualState x:Name="Checked"> | |
<VisualState.Setters> | |
<Setter Target="UnderlineRectangle.Visibility" | |
Value="Visible" /> | |
</VisualState.Setters> | |
</VisualState> | |
<VisualState x:Name="Unchecked" /> | |
<VisualState x:Name="Indeterminate" /> | |
</VisualStateGroup> | |
</VisualStateManager.VisualStateGroups> | |
<Rectangle x:Name="UnderlineRectangle" | |
Fill="{TemplateBinding BorderBrush}" | |
Visibility="Collapsed" | |
Grid.Row="1" /> | |
<ContentPresenter x:Name="ContentPresenter" | |
AutomationProperties.AccessibilityView="Raw" | |
ContentTemplate="{TemplateBinding ContentTemplate}" | |
Content="{TemplateBinding Content}" | |
ContentTransitions="{TemplateBinding ContentTransitions}" | |
Foreground="{TemplateBinding Foreground}" | |
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" | |
Margin="{TemplateBinding Padding}" | |
TextWrapping="Wrap" | |
VerticalAlignment="{TemplateBinding VerticalContentAlignment}" /> | |
</Grid> | |
</ControlTemplate> | |
</Setter.Value> | |
</Setter> | |
</Style> | |
</Page.Resources> | |
<Grid> | |
<StackPanel Orientation="Horizontal" VerticalAlignment="Top" | |
HorizontalAlignment="Center" Background="#603D3D3D" | |
Margin="50" Height="80"> | |
<RadioButton Style="{StaticResource UnderlinedRadioButtonStyle}" | |
Content="Enhance" Width="120" IsChecked="True" /> | |
<RadioButton Style="{StaticResource UnderlinedRadioButtonStyle}" | |
Content="Adjust" Width="120" /> | |
</StackPanel> | |
</Grid> | |
</Page> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment