|
60 | 60 | <Grid>
|
61 | 61 | <Grid.Resources>
|
62 | 62 | <local:EnumBooleanConverter x:Key="ComparisonConverter" />
|
| 63 | + |
| 64 | + <!-- https://stackoverflow.com/a/18400415/5452781 --> |
| 65 | + <!-- Brushes for colours/backgrounds --> |
| 66 | + <SolidColorBrush x:Key="BackgroundBrushKey" Color="Transparent"/> |
| 67 | + <SolidColorBrush x:Key="BorderBrushHiddenKey" Color="Transparent"/> |
| 68 | + <SolidColorBrush x:Key="CheckedBrushKey" Color="Black"/> |
| 69 | + |
| 70 | + <!-- Template --> |
| 71 | + <ControlTemplate x:Key="ToggleButtonLeft" TargetType="{x:Type ToggleButton}"> |
| 72 | + <Border |
| 73 | + Name="Border" |
| 74 | + Background="{StaticResource BackgroundBrushKey}" |
| 75 | + BorderBrush="{StaticResource BorderBrushHiddenKey}" |
| 76 | + BorderThickness="1" |
| 77 | + CornerRadius="0,0,0,0"> |
| 78 | + <ContentPresenter |
| 79 | + HorizontalAlignment="Center" |
| 80 | + Margin="{TemplateBinding Padding}" |
| 81 | + VerticalAlignment="Center" |
| 82 | + Content="{TemplateBinding Content}" |
| 83 | + /> |
| 84 | + </Border> |
| 85 | + <ControlTemplate.Triggers> |
| 86 | + <Trigger Property="ToggleButton.IsMouseOver" Value="true"> |
| 87 | + <Setter TargetName="Border" Property="Background" Value="Yellow"/> |
| 88 | + </Trigger> |
| 89 | + <Trigger Property="IsChecked" Value="true"> |
| 90 | + <Setter TargetName="Border" Property="Background" Value="{StaticResource CheckedBrushKey}"/> |
| 91 | + </Trigger> |
| 92 | + </ControlTemplate.Triggers> |
| 93 | + </ControlTemplate> |
63 | 94 | </Grid.Resources>
|
64 | 95 |
|
65 | 96 | <ToolBarTray Background="#FF1F1F1F" Height="32" VerticalAlignment="Top">
|
|
73 | 104 | </ToolBar>
|
74 | 105 |
|
75 | 106 | <ToolBar Band="1" BandIndex="1" VerticalAlignment="Top" Background="#FF9C9C9C">
|
76 |
| - <RadioButton GroupName="Toolbar" Tag="Draw" ToolTip="Brush (D)" Style="{StaticResource {x:Type ToggleButton}}" |
| 107 | + <RadioButton GroupName="Toolbar" Tag="Draw" ToolTip="Brush (D)" Template="{DynamicResource ToggleButtonLeft}" Style="{StaticResource {x:Type ToggleButton}}" |
77 | 108 | IsChecked="{Binding Path=CurrentTool, Converter={StaticResource ComparisonConverter}, ConverterParameter={x:Static local:ToolMode.Draw},Mode=TwoWay}">
|
78 | 109 | <Image Source="/Resources/Buttons/drawmode.png" Width="24" Height="24" RenderOptions.BitmapScalingMode="NearestNeighbor" />
|
79 | 110 | </RadioButton>
|
80 |
| - <RadioButton GroupName="Toolbar" Tag="Fill" ToolTip="Flood Fill (F)" Style="{StaticResource {x:Type ToggleButton}}" |
| 111 | + <RadioButton GroupName="Toolbar" Tag="Fill" ToolTip="Flood Fill (F)" Template="{DynamicResource ToggleButtonLeft}" Style="{StaticResource {x:Type ToggleButton}}" |
81 | 112 | IsChecked="{Binding Path=CurrentTool, Converter={StaticResource ComparisonConverter}, ConverterParameter={x:Static local:ToolMode.Fill},Mode=TwoWay}">
|
82 | 113 | <Image Source="/Resources/Buttons/paint.png" Width="24" Height="24" RenderOptions.BitmapScalingMode="NearestNeighbor" />
|
83 | 114 | </RadioButton>
|
|
176 | 207 | <Rectangle x:Name="rectSecondaryColor" Fill="Black" HorizontalAlignment="Left" Height="28" Margin="47,276,0,0" Stroke="Black" VerticalAlignment="Top" Width="28"/>
|
177 | 208 |
|
178 | 209 | <!-- https://stackoverflow.com/a/32514853/5452781 -->
|
179 |
| - <Rectangle x:Name="tempRect" Width="200" Height="200" Margin="459,130,0,0" SnapsToDevicePixels="True" HorizontalAlignment="Left" VerticalAlignment="Top" UseLayoutRounding="False" Fill="Black" /> |
180 |
| - <Rectangle x:Name="rectSaturation" Fill="{StaticResource LevelSaturationBrush}" Width="200" Height="200" Margin="459,130,0,0" StrokeThickness="1" SnapsToDevicePixels="True" HorizontalAlignment="Left" VerticalAlignment="Top" /> |
181 |
| - <Rectangle x:Name="rectHueBar" Fill="{StaticResource HueBrush}" Width="20" Height="200" Margin="664,130,0,0" Stroke="Black" StrokeThickness="1" SnapsToDevicePixels="True" MouseDown="rectHueBar_MouseDown" HorizontalAlignment="Left" VerticalAlignment="Top" /> |
| 210 | + <Rectangle x:Name="tempRect" Width="200" Height="200" Margin="459,130,0,0" SnapsToDevicePixels="True" HorizontalAlignment="Left" VerticalAlignment="Top" UseLayoutRounding="False" Fill="Black" /> |
| 211 | + <Rectangle x:Name="rectSaturation" Fill="{StaticResource LevelSaturationBrush}" Width="200" Height="200" Margin="459,130,0,0" StrokeThickness="1" SnapsToDevicePixels="True" HorizontalAlignment="Left" VerticalAlignment="Top" MouseDown="OnLevelSaturationMouseDown" /> |
| 212 | + <Rectangle x:Name="rectHueBar" Fill="{StaticResource HueBrush}" Width="20" Height="200" Margin="664,130,0,0" Stroke="Black" StrokeThickness="1" SnapsToDevicePixels="True" MouseDown="rectHueBar_MouseDown" HorizontalAlignment="Left" VerticalAlignment="Top" /> |
182 | 213 |
|
183 | 214 | </Grid>
|
184 | 215 | </Window>
|
0 commit comments