|
4 | 4 | xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" |
5 | 5 | xmlns:d="http://schemas.microsoft.com/expression/blend/2008" |
6 | 6 | xmlns:local="clr-namespace:grzyClothTool.Controls" |
| 7 | + xmlns:icons="clr-namespace:Material.Icons.WPF;assembly=Material.Icons.WPF" |
7 | 8 | x:Name="MyCustomButton" |
8 | 9 | d:Height="40" d:Width="280" |
9 | 10 | mc:Ignorable="d"> |
10 | 11 | <UserControl.Resources> |
11 | 12 | <Style TargetType="Button" x:Key="RoundedButton"> |
12 | 13 | <Setter Property="TextBlock.TextAlignment" Value="Center" /> |
13 | | - <Setter Property="Background" Value="{StaticResource Brush200}" /> |
14 | | - <Setter Property="Foreground" Value="{StaticResource ButtonFocus}" /> |
| 14 | + <Setter Property="Background" Value="{DynamicResource Brush200}" /> |
| 15 | + <Setter Property="Foreground" Value="{DynamicResource Brush950}" /> |
15 | 16 | <Setter Property="Template"> |
16 | 17 | <Setter.Value> |
17 | 18 | <ControlTemplate TargetType="{x:Type Button}"> |
|
28 | 29 | </Style.Resources> |
29 | 30 | <Style.Triggers> |
30 | 31 | <Trigger Property="IsMouseOver" Value="True"> |
31 | | - <Setter Property="Background" Value="{StaticResource Brush300}" /> |
| 32 | + <Setter Property="Background" Value="{DynamicResource Brush300}" /> |
32 | 33 | </Trigger> |
33 | 34 | <Trigger Property="IsEnabled" Value="False"> |
34 | 35 | <Trigger.Setters> |
35 | | - <Setter Property="Opacity" Value="{StaticResource DisabledOpacity}" /> |
| 36 | + <Setter Property="Opacity" Value="{DynamicResource DisabledOpacity}" /> |
36 | 37 | </Trigger.Setters> |
37 | 38 | </Trigger> |
38 | 39 | </Style.Triggers> |
|
41 | 42 | <Style x:Key="ToggleButtonVisibility" TargetType="ToggleButton"> |
42 | 43 | <Setter Property="Visibility" Value="Hidden" /> |
43 | 44 | <Setter Property="TextBlock.TextAlignment" Value="Center" /> |
44 | | - <Setter Property="Background" Value="{StaticResource Brush200}" /> |
45 | | - <Setter Property="Foreground" Value="{StaticResource ButtonFocus}" /> |
| 45 | + <Setter Property="Background" Value="{DynamicResource Brush200}" /> |
| 46 | + <Setter Property="Foreground" Value="{DynamicResource Brush950}" /> |
46 | 47 | <Setter Property="Template"> |
47 | 48 | <Setter.Value> |
48 | 49 | <ControlTemplate TargetType="{x:Type ToggleButton}"> |
|
57 | 58 | <Setter Property="Visibility" Value="Visible" /> |
58 | 59 | </DataTrigger> |
59 | 60 | <Trigger Property="IsMouseOver" Value="True"> |
60 | | - <Setter Property="Background" Value="{StaticResource Brush300}" /> |
| 61 | + <Setter Property="Background" Value="{DynamicResource Brush300}" /> |
61 | 62 | </Trigger> |
62 | 63 | </Style.Triggers> |
63 | 64 | <Style.Resources> |
|
70 | 71 |
|
71 | 72 |
|
72 | 73 | <Grid> |
73 | | - <Border x:Name="btn" BorderBrush="{StaticResource ButtonBorder}" BorderThickness="0" CornerRadius="{Binding CornerRadius, ElementName=MyCustomButton}"> |
| 74 | + <Border x:Name="btn" BorderBrush="{DynamicResource Brush400}" BorderThickness="0" CornerRadius="{Binding CornerRadius, ElementName=MyCustomButton}"> |
74 | 75 | <Button Content="{Binding Label, ElementName=MyCustomButton}" ToolTip="{Binding Tooltip, ElementName=MyCustomButton}" BorderThickness="0" HorizontalContentAlignment="Center" VerticalContentAlignment="Center" FontSize="16" Click="Button_Click"> |
75 | 76 | <Button.Style> |
76 | 77 | <Style TargetType="Button" BasedOn="{StaticResource RoundedButton}"> |
77 | 78 | <Setter Property="ContentTemplate"> |
78 | 79 | <Setter.Value> |
79 | 80 | <DataTemplate> |
80 | | - <Image Source="{Binding Image, ElementName=MyCustomButton}" /> |
| 81 | + <icons:MaterialIcon Kind="{Binding Image, ElementName=MyCustomButton}" Foreground="{DynamicResource Brush950}" /> |
81 | 82 | </DataTemplate> |
82 | 83 | </Setter.Value> |
83 | 84 | </Setter> |
|
97 | 98 | </Button> |
98 | 99 | </Border> |
99 | 100 |
|
100 | | - <ToggleButton Style="{StaticResource ToggleButtonVisibility}" x:Name="DropdownToggle" HorizontalAlignment="Right" VerticalAlignment="Center" Width="30" Height="{Binding ActualHeight, ElementName=btn}" > |
101 | | - <Path Data="M 0 0 L 4 4 L 8 0 Z" Fill="{StaticResource ButtonFocus}" Width="12" Height="8" Stretch="Fill" /> |
| 101 | + <ToggleButton Style="{DynamicResource ToggleButtonVisibility}" x:Name="DropdownToggle" HorizontalAlignment="Right" VerticalAlignment="Center" Width="30" Height="{Binding ActualHeight, ElementName=btn}" > |
| 102 | + <Path Data="M 0 0 L 4 4 L 8 0 Z" Fill="{DynamicResource Brush950}" Width="12" Height="8" Stretch="Fill" /> |
102 | 103 | </ToggleButton> |
103 | 104 |
|
104 | 105 | <Popup Width="{Binding ActualWidth, ElementName=btn}" PlacementTarget="{Binding ElementName=btn}" Placement="Bottom" StaysOpen="False" IsOpen="{Binding IsChecked, ElementName=DropdownToggle}" AllowsTransparency="True"> |
105 | | - <Border CornerRadius="{Binding CornerRadius, ElementName=MyCustomButton}" Background="{StaticResource Brush400}" Padding="1" BorderThickness="1"> |
| 106 | + <Border CornerRadius="{Binding CornerRadius, ElementName=MyCustomButton}" Background="{DynamicResource Brush400}" Padding="1" BorderThickness="1"> |
106 | 107 | <ContentPresenter x:Name="DropdownContentPresenter" Content="{Binding Content, ElementName=MyCustomButton}" /> |
107 | 108 | </Border> |
108 | 109 | </Popup> |
|
0 commit comments