feat: add style.
This commit is contained in:
@@ -10,78 +10,96 @@
|
||||
</Design.PreviewWith>
|
||||
<ControlTheme x:Key="{x:Type u:IPv4Box}" TargetType="{x:Type u:IPv4Box}">
|
||||
<Setter Property="u:IPv4Box.Focusable" Value="True" />
|
||||
<Setter Property="u:IPv4Box.ShowLeadingZero" Value="True" />
|
||||
<Setter Property="u:IPv4Box.TextAlignment" Value="Center" />
|
||||
<Setter Property="u:IPv4Box.HorizontalAlignment" Value="Left" />
|
||||
<Setter Property="u:IPv4Box.CornerRadius" Value="{DynamicResource IPv4BoxCornerRadius}" />
|
||||
<Setter Property="u:IPv4Box.Background" Value="{DynamicResource IPv4BoxBackground}" />
|
||||
<Setter Property="u:IPv4Box.MinHeight" Value="{DynamicResource IPv4BoxDefaultMinHeight}" />
|
||||
<Setter Property="u:IPv4Box.BorderThickness" Value="{DynamicResource IPv4BoxBorderThickness}" />
|
||||
<Setter Property="u:IPv4Box.SelectionBrush" Value="{DynamicResource IPv4BoxSelectionBrush}" />
|
||||
<Setter Property="u:IPv4Box.SelectionForegroundBrush" Value="{DynamicResource IPv4BoxSelectionForeground}" />
|
||||
<Setter Property="u:IPv4Box.CaretBrush" Value="{DynamicResource IPv4BoxCaretBrush}" />
|
||||
<Setter Property="u:IPv4Box.Template">
|
||||
<ControlTemplate TargetType="u:IPv4Box">
|
||||
<Border
|
||||
Name="PART_Border"
|
||||
MinHeight="30"
|
||||
HorizontalAlignment="{TemplateBinding HorizontalAlignment}"
|
||||
Background="Transparent"
|
||||
BorderBrush="Black"
|
||||
BorderThickness="1"
|
||||
CornerRadius="3">
|
||||
Background="{TemplateBinding Background}"
|
||||
BorderBrush="{TemplateBinding BorderBrush}"
|
||||
BorderThickness="{TemplateBinding BorderThickness}"
|
||||
CornerRadius="{TemplateBinding CornerRadius}">
|
||||
<Grid Width="{TemplateBinding Width}" ColumnDefinitions="1*, Auto, 1*, Auto, 1*, Auto, 1*">
|
||||
<TextPresenter
|
||||
Name="{x:Static u:IPv4Box.PART_FirstTextPresenter}"
|
||||
Grid.Column="0"
|
||||
MinWidth="5"
|
||||
MinWidth="8"
|
||||
VerticalAlignment="Center"
|
||||
CaretBrush="{TemplateBinding CaretBrush}"
|
||||
Cursor="IBeam"
|
||||
SelectionBrush="Blue"
|
||||
SelectionForegroundBrush="White"
|
||||
Text="123"
|
||||
TextAlignment="Center" />
|
||||
SelectionBrush="{TemplateBinding SelectionBrush}"
|
||||
SelectionForegroundBrush="{TemplateBinding SelectionForegroundBrush}"
|
||||
TextAlignment="{TemplateBinding TextAlignment}" />
|
||||
<TextBlock
|
||||
Grid.Column="1"
|
||||
Margin="0,4"
|
||||
VerticalAlignment="Bottom"
|
||||
VerticalAlignment="Center"
|
||||
Focusable="False"
|
||||
Text="." />
|
||||
<TextPresenter
|
||||
Name="{x:Static u:IPv4Box.PART_SecondTextPresenter}"
|
||||
Grid.Column="2"
|
||||
MinWidth="5"
|
||||
MinWidth="8"
|
||||
VerticalAlignment="Center"
|
||||
CaretBrush="{TemplateBinding CaretBrush}"
|
||||
Cursor="IBeam"
|
||||
SelectionBrush="Blue"
|
||||
SelectionForegroundBrush="White"
|
||||
Text="123"
|
||||
TextAlignment="Center" />
|
||||
SelectionBrush="{TemplateBinding SelectionBrush}"
|
||||
SelectionForegroundBrush="{TemplateBinding SelectionForegroundBrush}"
|
||||
TextAlignment="{TemplateBinding TextAlignment}" />
|
||||
<TextBlock
|
||||
Grid.Column="3"
|
||||
Margin="0,4"
|
||||
VerticalAlignment="Bottom"
|
||||
VerticalAlignment="Center"
|
||||
Text="." />
|
||||
<TextPresenter
|
||||
Name="{x:Static u:IPv4Box.PART_ThirdTextPresenter}"
|
||||
Grid.Column="4"
|
||||
MinWidth="5"
|
||||
MinWidth="8"
|
||||
VerticalAlignment="Center"
|
||||
CaretBrush="{TemplateBinding CaretBrush}"
|
||||
Cursor="IBeam"
|
||||
SelectionBrush="Blue"
|
||||
SelectionForegroundBrush="White"
|
||||
TextAlignment="Center" />
|
||||
SelectionBrush="{TemplateBinding SelectionBrush}"
|
||||
SelectionForegroundBrush="{TemplateBinding SelectionForegroundBrush}"
|
||||
TextAlignment="{TemplateBinding TextAlignment}" />
|
||||
<TextBlock
|
||||
Grid.Column="5"
|
||||
Margin="0,4"
|
||||
VerticalAlignment="Bottom"
|
||||
VerticalAlignment="Center"
|
||||
Text="." />
|
||||
<TextPresenter
|
||||
Name="{x:Static u:IPv4Box.PART_FourthTextPresenter}"
|
||||
Grid.Column="6"
|
||||
MinWidth="5"
|
||||
MinWidth="8"
|
||||
VerticalAlignment="Center"
|
||||
CaretBrush="{TemplateBinding CaretBrush}"
|
||||
Cursor="IBeam"
|
||||
SelectionBrush="Blue"
|
||||
SelectionForegroundBrush="White"
|
||||
TextAlignment="Center" />
|
||||
SelectionBrush="{TemplateBinding SelectionBrush}"
|
||||
SelectionForegroundBrush="{TemplateBinding SelectionForegroundBrush}"
|
||||
TextAlignment="{TemplateBinding TextAlignment}" />
|
||||
</Grid>
|
||||
</Border>
|
||||
</ControlTemplate>
|
||||
</Setter>
|
||||
<Style Selector="^:focus-within /template/ Border#PART_Border">
|
||||
<Setter Property="BorderBrush" Value="Red" />
|
||||
<Style Selector="^:pointerover /template/ Border#PART_Border">
|
||||
<Setter Property="Border.Background" Value="{DynamicResource IPv4BoxPointeroverBackground}" />
|
||||
</Style>
|
||||
<Style Selector="^:pressed /template/ Border#PART_Border">
|
||||
<Setter Property="Border.Background" Value="{DynamicResource IPv4BoxPressedBackground}" />
|
||||
</Style>
|
||||
<Style Selector="^:focus-within">
|
||||
<Setter Property="Border.BorderBrush" Value="{DynamicResource IPv4BoxFocusBorderBrush}" />
|
||||
</Style>
|
||||
<Style Selector="^:disabled">
|
||||
<Setter Property="Border.Background" Value="{DynamicResource IPv4BoxDisabledBackground}" />
|
||||
</Style>
|
||||
</ControlTheme>
|
||||
</ResourceDictionary>
|
||||
|
||||
12
src/Ursa.Themes.Semi/Themes/Dark/IPv4Box.axaml
Normal file
12
src/Ursa.Themes.Semi/Themes/Dark/IPv4Box.axaml
Normal file
@@ -0,0 +1,12 @@
|
||||
<ResourceDictionary xmlns="https://github.com/avaloniaui" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
|
||||
<!-- Add Resources Here -->
|
||||
<SolidColorBrush x:Key="IPv4BoxBackground" Opacity="0.12" Color="White" />
|
||||
<SolidColorBrush x:Key="IPv4BoxPointeroverBackground" Opacity="0.16" Color="White" />
|
||||
<SolidColorBrush x:Key="IPv4BoxPressedBackground" Opacity="0.2" Color="White" />
|
||||
<SolidColorBrush x:Key="IPv4BoxBorderBrush" Color="Transparent" />
|
||||
<SolidColorBrush x:Key="IPv4BoxDisabledBackground" Opacity="0.04" Color="#E6E8EA" />
|
||||
<SolidColorBrush x:Key="IPv4BoxFocusBorderBrush" Color="#FF54A9FF" />
|
||||
<SolidColorBrush x:Key="IPv4BoxSelectionBrush" Color="#FF54A9FF" />
|
||||
<SolidColorBrush x:Key="IPv4BoxSelectionForeground" Color="White" />
|
||||
<SolidColorBrush x:Key="IPv4BoxCaretBrush" Color="White" />
|
||||
</ResourceDictionary>
|
||||
@@ -3,5 +3,6 @@
|
||||
<ResourceDictionary.MergedDictionaries>
|
||||
<ResourceInclude Source="Badge.axaml" />
|
||||
<ResourceInclude Source="Banner.axaml" />
|
||||
<ResourceInclude Source="IPv4Box.axaml" />
|
||||
</ResourceDictionary.MergedDictionaries>
|
||||
</ResourceDictionary>
|
||||
|
||||
12
src/Ursa.Themes.Semi/Themes/Light/IPv4Box.axaml
Normal file
12
src/Ursa.Themes.Semi/Themes/Light/IPv4Box.axaml
Normal file
@@ -0,0 +1,12 @@
|
||||
<ResourceDictionary xmlns="https://github.com/avaloniaui" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
|
||||
<!-- Add Resources Here -->
|
||||
<SolidColorBrush x:Key="IPv4BoxBackground" Opacity="0.05" Color="#FF2E3238" />
|
||||
<SolidColorBrush x:Key="IPv4BoxPointeroverBackground" Opacity="0.09" Color="#FF2E3238" />
|
||||
<SolidColorBrush x:Key="IPv4BoxPressedBackground" Opacity="0.13" Color="#FF2E3238" />
|
||||
<SolidColorBrush x:Key="IPv4BoxBorderBrush" Color="Transparent" />
|
||||
<SolidColorBrush x:Key="IPv4BoxDisabledBackground" Opacity="0.04" Color="#2E3238" />
|
||||
<SolidColorBrush x:Key="IPv4BoxFocusBorderBrush" Color="#FF0077FA" />
|
||||
<SolidColorBrush x:Key="IPv4BoxSelectionBrush" Color="#FF0077FA" />
|
||||
<SolidColorBrush x:Key="IPv4BoxSelectionForeground" Color="White" />
|
||||
<SolidColorBrush x:Key="IPv4BoxCaretBrush" Color="Black" />
|
||||
</ResourceDictionary>
|
||||
@@ -3,5 +3,6 @@
|
||||
<ResourceDictionary.MergedDictionaries>
|
||||
<ResourceInclude Source="Badge.axaml" />
|
||||
<ResourceInclude Source="Banner.axaml" />
|
||||
<ResourceInclude Source="IPv4Box.axaml" />
|
||||
</ResourceDictionary.MergedDictionaries>
|
||||
</ResourceDictionary>
|
||||
|
||||
8
src/Ursa.Themes.Semi/Themes/Shared/IPv4Box.axaml
Normal file
8
src/Ursa.Themes.Semi/Themes/Shared/IPv4Box.axaml
Normal file
@@ -0,0 +1,8 @@
|
||||
<ResourceDictionary xmlns="https://github.com/avaloniaui" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
|
||||
<!-- Add Resources Here -->
|
||||
<x:Double x:Key="IPv4BoxDefaultMinHeight">32</x:Double>
|
||||
<x:Double x:Key="IPv4BoxSmallMinHeight">24</x:Double>
|
||||
<x:Double x:Key="IPv4BoxLargeMinHeight">40</x:Double>
|
||||
<Thickness x:Key="IPv4BoxBorderThickness">1</Thickness>
|
||||
<CornerRadius x:Key="IPv4BoxCornerRadius">3</CornerRadius>
|
||||
</ResourceDictionary>
|
||||
@@ -3,5 +3,6 @@
|
||||
<ResourceDictionary.MergedDictionaries>
|
||||
<ResourceInclude Source="Badge.axaml" />
|
||||
<ResourceInclude Source="Banner.axaml" />
|
||||
<ResourceInclude Source="IPv4Box.axaml" />
|
||||
</ResourceDictionary.MergedDictionaries>
|
||||
</ResourceDictionary>
|
||||
|
||||
Reference in New Issue
Block a user