Skip to content

Commit

Permalink
Merge pull request #992 from kenjiuno/fix-new-checkbox
Browse files Browse the repository at this point in the history
Apply an alternative CheckBox default style to ModsManager
Closes
  • Loading branch information
Delta-473 authored Aug 22, 2024
2 parents 5e37bf7 + 9c6b470 commit 0c9392e
Show file tree
Hide file tree
Showing 3 changed files with 131 additions and 3 deletions.
1 change: 1 addition & 0 deletions OpenKh.Tools.ModsManager/App.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="pack://application:,,,/Xe.Tools.Wpf;component/Themes/Generic.xaml"/>
<ResourceDictionary Source="Styles/MonoStyleCheckBox.xaml" />
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</Application.Resources>
Expand Down
130 changes: 130 additions & 0 deletions OpenKh.Tools.ModsManager/Styles/MonoStyleCheckBox.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,130 @@
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<Style TargetType="{x:Type CheckBox}">
<Setter Property="SnapsToDevicePixels"
Value="true" />
<Setter Property="OverridesDefaultStyle"
Value="true" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type CheckBox}">
<BulletDecorator Background="Transparent">
<BulletDecorator.Bullet>
<Border x:Name="Border"
Width="13"
Height="13"
BorderBrush="{TemplateBinding Foreground}"
CornerRadius="0"
BorderThickness="1">
<Grid>
<Path Visibility="Collapsed"
Width="7"
Height="7"
x:Name="CheckMark"
SnapsToDevicePixels="False"
StrokeThickness="2"
Stroke="{TemplateBinding Foreground}"
Data="M 0 0 L 7 7 M 0 7 L 7 0">
</Path>
<Path Visibility="Collapsed"
Width="7"
Height="7"
x:Name="InderminateMark"
SnapsToDevicePixels="False"
StrokeThickness="2"
Stroke="{TemplateBinding Foreground}"
Data="M 0 7 L 7 0">
</Path>
</Grid>
</Border>
</BulletDecorator.Bullet>
<VisualStateManager.VisualStateGroups>
<VisualStateGroup x:Name="CommonStates">
<VisualState x:Name="Normal" />
<VisualState x:Name="MouseOver">
<Storyboard>
<DoubleAnimationUsingKeyFrames Storyboard.TargetName="Border"
Storyboard.TargetProperty="Opacity">
<EasingDoubleKeyFrame KeyTime="0"
Value="0.7" />
</DoubleAnimationUsingKeyFrames>
</Storyboard>
</VisualState>
<VisualState x:Name="Pressed">
<Storyboard>
<DoubleAnimationUsingKeyFrames Storyboard.TargetName="Border"
Storyboard.TargetProperty="Opacity">
<EasingDoubleKeyFrame KeyTime="0"
Value="0.6" />
</DoubleAnimationUsingKeyFrames>
<ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="(Border.Background)"
Storyboard.TargetName="Border">
<DiscreteObjectKeyFrame KeyTime="0">
<DiscreteObjectKeyFrame.Value>
<SolidColorBrush Color="LightGray" />
</DiscreteObjectKeyFrame.Value>
</DiscreteObjectKeyFrame>
</ObjectAnimationUsingKeyFrames>
</Storyboard>
</VisualState>
<VisualState x:Name="Disabled">
<Storyboard>
<ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="(Border.Background)"
Storyboard.TargetName="Border">
<DiscreteObjectKeyFrame KeyTime="0">
<DiscreteObjectKeyFrame.Value>
<SolidColorBrush Color="LightGray" />
</DiscreteObjectKeyFrame.Value>
</DiscreteObjectKeyFrame>
</ObjectAnimationUsingKeyFrames>
<ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="(Path.Stroke)"
Storyboard.TargetName="CheckMark">
<DiscreteObjectKeyFrame KeyTime="0">
<DiscreteObjectKeyFrame.Value>
<SolidColorBrush Color="Black" />
</DiscreteObjectKeyFrame.Value>
</DiscreteObjectKeyFrame>
</ObjectAnimationUsingKeyFrames>
<ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="(Path.Stroke)"
Storyboard.TargetName="InderminateMark">
<DiscreteObjectKeyFrame KeyTime="0">
<DiscreteObjectKeyFrame.Value>
<SolidColorBrush Color="Black" />
</DiscreteObjectKeyFrame.Value>
</DiscreteObjectKeyFrame>
</ObjectAnimationUsingKeyFrames>
</Storyboard>
</VisualState>
</VisualStateGroup>
<VisualStateGroup x:Name="CheckStates">
<VisualState x:Name="Checked">
<Storyboard>
<ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Visibility)"
Storyboard.TargetName="CheckMark">
<DiscreteObjectKeyFrame KeyTime="0"
Value="{x:Static Visibility.Visible}" />
</ObjectAnimationUsingKeyFrames>
</Storyboard>
</VisualState>
<VisualState x:Name="Unchecked" />
<VisualState x:Name="Indeterminate">
<Storyboard>
<ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Visibility)"
Storyboard.TargetName="InderminateMark">
<DiscreteObjectKeyFrame KeyTime="0"
Value="{x:Static Visibility.Visible}" />
</ObjectAnimationUsingKeyFrames>
</Storyboard>
</VisualState>
</VisualStateGroup>
</VisualStateManager.VisualStateGroups>
<ContentPresenter Margin="4,0,0,0"
VerticalAlignment="Center"
HorizontalAlignment="Left"
RecognizesAccessKey="True" />
</BulletDecorator>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</ResourceDictionary>
3 changes: 0 additions & 3 deletions OpenKh.Tools.ModsManager/Views/SetupWizardWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,6 @@
<Window.Resources>
<BooleanToVisibilityConverter x:Key="BooleanToVisibilityConverter"/>
<SolidColorBrush x:Key="textHyperlink" Color="#569CD6" />
<Style TargetType="CheckBox">
<Setter Property="Foreground" Value="{Binding ColorTheme.TextColor}"/>
</Style>
<Style TargetType="xctk:WizardPage">
<Setter Property="Foreground" Value="{Binding ColorTheme.TextColor}"/>
<Setter Property="Background" Value="{Binding ColorTheme.BackgroundColor}"/>
Expand Down

0 comments on commit 0c9392e

Please sign in to comment.