|
| 1 | +<Styles xmlns="https://github.com/avaloniaui" |
| 2 | + xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" |
| 3 | + xmlns:controls="clr-namespace:CrissCross.Avalonia.UI.Controls;assembly=CrissCross.Avalonia.UI"> |
| 4 | + |
| 5 | + <!-- CrissCross BezelButton Style - A button with a beveled/raised 3D appearance --> |
| 6 | + <Style Selector="controls|BezelButton"> |
| 7 | + <Setter Property="Background" Value="{DynamicResource ButtonBackground}" /> |
| 8 | + <Setter Property="Foreground" Value="{DynamicResource ButtonForeground}" /> |
| 9 | + <Setter Property="BorderBrush" Value="{DynamicResource ButtonBorderBrush}" /> |
| 10 | + <Setter Property="BorderThickness" Value="1" /> |
| 11 | + <Setter Property="Padding" Value="16,8" /> |
| 12 | + <Setter Property="HorizontalContentAlignment" Value="Center" /> |
| 13 | + <Setter Property="VerticalContentAlignment" Value="Center" /> |
| 14 | + <Setter Property="OuterCornerRadius" Value="6" /> |
| 15 | + <Setter Property="InnerCornerRadius" Value="4" /> |
| 16 | + <Setter Property="FocusBrush" Value="{DynamicResource SystemAccentColor}" /> |
| 17 | + <Setter Property="FocusBorderThickness" Value="2" /> |
| 18 | + <Setter Property="Template"> |
| 19 | + <ControlTemplate> |
| 20 | + <Grid> |
| 21 | + <!-- Outer bezel (light top-left, dark bottom-right for 3D effect) --> |
| 22 | + <Border Name="OuterBezel" |
| 23 | + CornerRadius="{TemplateBinding OuterCornerRadius}" |
| 24 | + Padding="3"> |
| 25 | + <Border.Background> |
| 26 | + <LinearGradientBrush StartPoint="0%,0%" EndPoint="100%,100%"> |
| 27 | + <GradientStop Offset="0" Color="#FFDDDDDD" /> |
| 28 | + <GradientStop Offset="0.5" Color="#FF888888" /> |
| 29 | + <GradientStop Offset="1" Color="#FF333333" /> |
| 30 | + </LinearGradientBrush> |
| 31 | + </Border.Background> |
| 32 | + |
| 33 | + <!-- Inner bezel (reverse gradient for depth) --> |
| 34 | + <Border Name="InnerBezel" |
| 35 | + CornerRadius="{TemplateBinding InnerCornerRadius}" |
| 36 | + Padding="2"> |
| 37 | + <Border.Background> |
| 38 | + <LinearGradientBrush StartPoint="0%,0%" EndPoint="100%,100%"> |
| 39 | + <GradientStop Offset="0" Color="#FF222222" /> |
| 40 | + <GradientStop Offset="0.5" Color="#FF666666" /> |
| 41 | + <GradientStop Offset="1" Color="#FFAAAAAA" /> |
| 42 | + </LinearGradientBrush> |
| 43 | + </Border.Background> |
| 44 | + |
| 45 | + <!-- Main button surface --> |
| 46 | + <Border Name="ButtonSurface" |
| 47 | + Background="{TemplateBinding Background}" |
| 48 | + CornerRadius="{TemplateBinding InnerCornerRadius}"> |
| 49 | + <Grid> |
| 50 | + <!-- Glare/highlight overlay --> |
| 51 | + <Border Name="GlareOverlay" |
| 52 | + CornerRadius="{TemplateBinding InnerCornerRadius}" |
| 53 | + IsHitTestVisible="False"> |
| 54 | + <Border.Background> |
| 55 | + <LinearGradientBrush StartPoint="0%,0%" EndPoint="0%,100%"> |
| 56 | + <GradientStop Offset="0" Color="#40FFFFFF" /> |
| 57 | + <GradientStop Offset="0.5" Color="#10FFFFFF" /> |
| 58 | + <GradientStop Offset="0.5" Color="Transparent" /> |
| 59 | + <GradientStop Offset="1" Color="Transparent" /> |
| 60 | + </LinearGradientBrush> |
| 61 | + </Border.Background> |
| 62 | + </Border> |
| 63 | + |
| 64 | + <!-- Pressed overlay --> |
| 65 | + <Border Name="PressedOverlay" |
| 66 | + CornerRadius="{TemplateBinding InnerCornerRadius}" |
| 67 | + IsHitTestVisible="False" |
| 68 | + IsVisible="False"> |
| 69 | + <Border.Background> |
| 70 | + <RadialGradientBrush> |
| 71 | + <GradientStop Offset="0" Color="Transparent" /> |
| 72 | + <GradientStop Offset="1" Color="#30000000" /> |
| 73 | + </RadialGradientBrush> |
| 74 | + </Border.Background> |
| 75 | + </Border> |
| 76 | + |
| 77 | + <!-- Content --> |
| 78 | + <ContentPresenter Name="PART_ContentPresenter" |
| 79 | + Content="{TemplateBinding Content}" |
| 80 | + ContentTemplate="{TemplateBinding ContentTemplate}" |
| 81 | + Padding="{TemplateBinding Padding}" |
| 82 | + HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}" |
| 83 | + VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}" |
| 84 | + TextBlock.Foreground="{TemplateBinding Foreground}" /> |
| 85 | + </Grid> |
| 86 | + </Border> |
| 87 | + </Border> |
| 88 | + </Border> |
| 89 | + |
| 90 | + <!-- Focus border --> |
| 91 | + <Border Name="FocusBorder" |
| 92 | + CornerRadius="{TemplateBinding OuterCornerRadius}" |
| 93 | + BorderBrush="{TemplateBinding FocusBrush}" |
| 94 | + BorderThickness="0" |
| 95 | + IsHitTestVisible="False" /> |
| 96 | + </Grid> |
| 97 | + </ControlTemplate> |
| 98 | + </Setter> |
| 99 | + </Style> |
| 100 | + |
| 101 | + <!-- Pressed state --> |
| 102 | + <Style Selector="controls|BezelButton:pressed /template/ Border#PressedOverlay"> |
| 103 | + <Setter Property="IsVisible" Value="True" /> |
| 104 | + </Style> |
| 105 | + |
| 106 | + <Style Selector="controls|BezelButton:pressed /template/ Border#GlareOverlay"> |
| 107 | + <Setter Property="Opacity" Value="0.3" /> |
| 108 | + </Style> |
| 109 | + |
| 110 | + <Style Selector="controls|BezelButton:pressed /template/ Border#OuterBezel"> |
| 111 | + <Setter Property="Background"> |
| 112 | + <LinearGradientBrush StartPoint="0%,0%" EndPoint="100%,100%"> |
| 113 | + <GradientStop Offset="0" Color="#FF333333" /> |
| 114 | + <GradientStop Offset="0.5" Color="#FF666666" /> |
| 115 | + <GradientStop Offset="1" Color="#FFAAAAAA" /> |
| 116 | + </LinearGradientBrush> |
| 117 | + </Setter> |
| 118 | + </Style> |
| 119 | + |
| 120 | + <Style Selector="controls|BezelButton:pressed /template/ Border#InnerBezel"> |
| 121 | + <Setter Property="Background"> |
| 122 | + <LinearGradientBrush StartPoint="0%,0%" EndPoint="100%,100%"> |
| 123 | + <GradientStop Offset="0" Color="#FFAAAAAA" /> |
| 124 | + <GradientStop Offset="0.5" Color="#FF888888" /> |
| 125 | + <GradientStop Offset="1" Color="#FF444444" /> |
| 126 | + </LinearGradientBrush> |
| 127 | + </Setter> |
| 128 | + </Style> |
| 129 | + |
| 130 | + <!-- Pointer over state --> |
| 131 | + <Style Selector="controls|BezelButton:pointerover /template/ Border#ButtonSurface"> |
| 132 | + <Setter Property="Background" Value="{DynamicResource ButtonBackgroundPointerOver}" /> |
| 133 | + </Style> |
| 134 | + |
| 135 | + <!-- Focus state --> |
| 136 | + <Style Selector="controls|BezelButton:focus-visible /template/ Border#FocusBorder"> |
| 137 | + <Setter Property="BorderThickness" Value="{Binding FocusBorderThickness, RelativeSource={RelativeSource TemplatedParent}}" /> |
| 138 | + </Style> |
| 139 | + |
| 140 | + <!-- Disabled state --> |
| 141 | + <Style Selector="controls|BezelButton:disabled"> |
| 142 | + <Setter Property="Opacity" Value="0.5" /> |
| 143 | + </Style> |
| 144 | + |
| 145 | + <Style Selector="controls|BezelButton:disabled /template/ Border#ButtonSurface"> |
| 146 | + <Setter Property="Background" Value="{DynamicResource ButtonBackgroundDisabled}" /> |
| 147 | + </Style> |
| 148 | + |
| 149 | + <Style Selector="controls|BezelButton:disabled /template/ ContentPresenter#PART_ContentPresenter"> |
| 150 | + <Setter Property="TextBlock.Foreground" Value="{DynamicResource ButtonForegroundDisabled}" /> |
| 151 | + </Style> |
| 152 | + |
| 153 | +</Styles> |
0 commit comments