chore: add avalonia TextBlock demo.
This commit is contained in:
1 parent
1d181c8f17
commit
528f3eaf95
7 files changed
+236
-41
No files matched your search
@@ -0,0 +1,61 @@
|
||||
<UserControl xmlns="https://github.com/avaloniaui"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:hc="https://handyorg.github.io/handycontrol"
|
||||
x:Class="HandyControlDemo.UserControl.TextBlockDemo"
|
||||
Background="{DynamicResource RegionBrush}">
|
||||
<ScrollViewer>
|
||||
<hc:UniformSpacingPanel Margin="32"
|
||||
Spacing="5"
|
||||
Orientation="Vertical">
|
||||
<TextBlock HorizontalAlignment="Left"
|
||||
Text="TextBlockLargeBold"
|
||||
Theme="{StaticResource TextBlockLargeBold}" />
|
||||
<TextBlock HorizontalAlignment="Left"
|
||||
Text="TextBlockLarge"
|
||||
Theme="{StaticResource TextBlockLarge}" />
|
||||
<TextBlock HorizontalAlignment="Left"
|
||||
Text="TextBlockHeaderBold"
|
||||
Theme="{StaticResource TextBlockTitleBold}" />
|
||||
<TextBlock HorizontalAlignment="Left"
|
||||
Text="TextBlockHeader"
|
||||
Theme="{StaticResource TextBlockTitle}" />
|
||||
<TextBlock HorizontalAlignment="Left"
|
||||
Text="TextBlockSubHeaderBold"
|
||||
Theme="{StaticResource TextBlockSubTitleBold}" />
|
||||
<TextBlock HorizontalAlignment="Left"
|
||||
Text="TextBlockSubHeader"
|
||||
Theme="{StaticResource TextBlockSubTitle}" />
|
||||
|
||||
<TextBlock HorizontalAlignment="Left"
|
||||
Text="TextBlockDefaultBold"
|
||||
Theme="{StaticResource TextBlockDefaultBold}" />
|
||||
<TextBlock HorizontalAlignment="Left"
|
||||
Text="TextBlockDefault"
|
||||
Theme="{StaticResource TextBlockDefault}" />
|
||||
<TextBlock HorizontalAlignment="Left"
|
||||
Text="TextBlockDefaultAccent"
|
||||
Theme="{StaticResource TextBlockDefaultAccent}" />
|
||||
<TextBlock HorizontalAlignment="Left"
|
||||
Text="TextBlockDefaultSecLight"
|
||||
Theme="{StaticResource TextBlockDefaultSecLight}" />
|
||||
<TextBlock HorizontalAlignment="Left"
|
||||
Text="TextBlockDefaultThiLight"
|
||||
Theme="{StaticResource TextBlockDefaultThiLight}" />
|
||||
<TextBlock HorizontalAlignment="Left"
|
||||
Text="TextBlockDefaultPrimary"
|
||||
Theme="{StaticResource TextBlockDefaultPrimary}" />
|
||||
<TextBlock HorizontalAlignment="Left"
|
||||
Text="TextBlockDefaultDanger"
|
||||
Theme="{StaticResource TextBlockDefaultDanger}" />
|
||||
<TextBlock HorizontalAlignment="Left"
|
||||
Text="TextBlockDefaultWarning"
|
||||
Theme="{StaticResource TextBlockDefaultWarning}" />
|
||||
<TextBlock HorizontalAlignment="Left"
|
||||
Text="TextBlockDefaultInfo"
|
||||
Theme="{StaticResource TextBlockDefaultInfo}" />
|
||||
<TextBlock HorizontalAlignment="Left"
|
||||
Text="TextBlockDefaultSuccess"
|
||||
Theme="{StaticResource TextBlockDefaultSuccess}" />
|
||||
</hc:UniformSpacingPanel>
|
||||
</ScrollViewer>
|
||||
</UserControl>
|
||||
@@ -0,0 +1,9 @@
|
||||
namespace HandyControlDemo.UserControl;
|
||||
|
||||
public partial class TextBlockDemo : Avalonia.Controls.UserControl
|
||||
{
|
||||
public TextBlockDemo()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
<ResourceDictionary xmlns="https://github.com/avaloniaui"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:system="using:System">
|
||||
<system:Double x:Key="LargeFontSize">24</system:Double>
|
||||
<system:Double x:Key="HeadFontSize">20</system:Double>
|
||||
<system:Double x:Key="SubHeadFontSize">16</system:Double>
|
||||
<system:Double x:Key="TextFontSize">12</system:Double>
|
||||
</ResourceDictionary>
|
||||
@@ -1,37 +0,0 @@
|
||||
<!-- ReSharper disable once Xaml.RedundantNamespaceAlias -->
|
||||
<Styles xmlns="https://github.com/avaloniaui"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:hc="clr-namespace:HandyControl.Controls">
|
||||
<Styles.Resources>
|
||||
<ResourceDictionary>
|
||||
<ResourceDictionary.MergedDictionaries>
|
||||
<MergeResourceInclude Source="avares://HandyControl/Themes/Basic/Geometries.axaml" />
|
||||
<MergeResourceInclude Source="avares://HandyControl/Themes/Basic/Paths.axaml" />
|
||||
<MergeResourceInclude Source="avares://HandyControl/Themes/Basic/Brushes.axaml" />
|
||||
<MergeResourceInclude Source="avares://HandyControl/Themes/Basic/Converters.axaml" />
|
||||
|
||||
<MergeResourceInclude Source="avares://HandyControl/Themes/Styles/ContentControl.axaml" />
|
||||
<MergeResourceInclude Source="avares://HandyControl/Themes/Styles/UserControl.axaml" />
|
||||
<MergeResourceInclude Source="avares://HandyControl/Themes/Styles/Window.axaml" />
|
||||
<MergeResourceInclude Source="avares://HandyControl/Themes/Styles/Button.axaml" />
|
||||
<MergeResourceInclude Source="avares://HandyControl/Themes/Styles/RepeatButton.axaml" />
|
||||
<MergeResourceInclude Source="avares://HandyControl/Themes/Styles/ToggleButton.axaml" />
|
||||
<MergeResourceInclude Source="avares://HandyControl/Themes/Styles/RadioButton.axaml" />
|
||||
<MergeResourceInclude Source="avares://HandyControl/Themes/Styles/CheckBox.axaml" />
|
||||
<MergeResourceInclude Source="avares://HandyControl/Themes/Styles/Border.axaml" />
|
||||
<MergeResourceInclude Source="avares://HandyControl/Themes/Styles/ItemsControl.axaml" />
|
||||
<MergeResourceInclude Source="avares://HandyControl/Themes/Styles/TabItem.axaml" />
|
||||
<MergeResourceInclude Source="avares://HandyControl/Themes/Styles/TabControl.axaml" />
|
||||
<MergeResourceInclude Source="avares://HandyControl/Themes/Styles/ListBoxItem.axaml" />
|
||||
<MergeResourceInclude Source="avares://HandyControl/Themes/Styles/ScrollViewer.axaml" />
|
||||
<MergeResourceInclude Source="avares://HandyControl/Themes/Styles/ListBox.axaml" />
|
||||
<MergeResourceInclude Source="avares://HandyControl/Themes/Styles/Label.axaml" />
|
||||
<MergeResourceInclude Source="avares://HandyControl/Themes/Styles/Slider.axaml" />
|
||||
</ResourceDictionary.MergedDictionaries>
|
||||
</ResourceDictionary>
|
||||
</Styles.Resources>
|
||||
<Style Selector=":is(UserControl)">
|
||||
<Setter Property="Theme"
|
||||
Value="{DynamicResource {x:Type UserControl}}" />
|
||||
</Style>
|
||||
</Styles>
|
||||
@@ -0,0 +1,125 @@
|
||||
<ResourceDictionary xmlns="https://github.com/avaloniaui"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
|
||||
<ControlTheme x:Key="TextBlockBaseStyle"
|
||||
TargetType="TextBlock">
|
||||
<Setter Property="VerticalAlignment"
|
||||
Value="Center" />
|
||||
<Setter Property="HorizontalAlignment"
|
||||
Value="Center" />
|
||||
<Setter Property="Foreground"
|
||||
Value="{DynamicResource PrimaryTextBrush}" />
|
||||
</ControlTheme>
|
||||
|
||||
<ControlTheme x:Key="TextBlockDefault"
|
||||
BasedOn="{StaticResource TextBlockBaseStyle}"
|
||||
TargetType="TextBlock" />
|
||||
|
||||
<ControlTheme x:Key="TextBlockDefaultAccent"
|
||||
BasedOn="{StaticResource TextBlockBaseStyle}"
|
||||
TargetType="TextBlock">
|
||||
<Setter Property="Foreground"
|
||||
Value="{DynamicResource AccentBrush}" />
|
||||
</ControlTheme>
|
||||
|
||||
<ControlTheme x:Key="TextBlockDefaultPrimary"
|
||||
BasedOn="{StaticResource TextBlockBaseStyle}"
|
||||
TargetType="TextBlock">
|
||||
<Setter Property="Foreground"
|
||||
Value="{DynamicResource PrimaryBrush}" />
|
||||
</ControlTheme>
|
||||
|
||||
<ControlTheme x:Key="TextBlockDefaultDanger"
|
||||
BasedOn="{StaticResource TextBlockBaseStyle}"
|
||||
TargetType="TextBlock">
|
||||
<Setter Property="Foreground"
|
||||
Value="{DynamicResource DangerBrush}" />
|
||||
</ControlTheme>
|
||||
|
||||
<ControlTheme x:Key="TextBlockDefaultWarning"
|
||||
BasedOn="{StaticResource TextBlockBaseStyle}"
|
||||
TargetType="TextBlock">
|
||||
<Setter Property="Foreground"
|
||||
Value="{DynamicResource WarningBrush}" />
|
||||
</ControlTheme>
|
||||
|
||||
<ControlTheme x:Key="TextBlockDefaultInfo"
|
||||
BasedOn="{StaticResource TextBlockBaseStyle}"
|
||||
TargetType="TextBlock">
|
||||
<Setter Property="Foreground"
|
||||
Value="{DynamicResource InfoBrush}" />
|
||||
</ControlTheme>
|
||||
|
||||
<ControlTheme x:Key="TextBlockDefaultSuccess"
|
||||
BasedOn="{StaticResource TextBlockBaseStyle}"
|
||||
TargetType="TextBlock">
|
||||
<Setter Property="Foreground"
|
||||
Value="{DynamicResource SuccessBrush}" />
|
||||
</ControlTheme>
|
||||
|
||||
<ControlTheme x:Key="TextBlockDefaultSecLight"
|
||||
BasedOn="{StaticResource TextBlockBaseStyle}"
|
||||
TargetType="TextBlock">
|
||||
<Setter Property="Foreground"
|
||||
Value="{DynamicResource SecondaryTextBrush}" />
|
||||
</ControlTheme>
|
||||
|
||||
<ControlTheme x:Key="TextBlockDefaultThiLight"
|
||||
BasedOn="{StaticResource TextBlockBaseStyle}"
|
||||
TargetType="TextBlock">
|
||||
<Setter Property="Foreground"
|
||||
Value="{DynamicResource ThirdlyTextBrush}" />
|
||||
</ControlTheme>
|
||||
|
||||
<ControlTheme x:Key="TextBlockLarge"
|
||||
BasedOn="{StaticResource TextBlockBaseStyle}"
|
||||
TargetType="TextBlock">
|
||||
<Setter Property="FontSize"
|
||||
Value="{StaticResource LargeFontSize}" />
|
||||
</ControlTheme>
|
||||
|
||||
<ControlTheme x:Key="TextBlockTitle"
|
||||
BasedOn="{StaticResource TextBlockBaseStyle}"
|
||||
TargetType="TextBlock">
|
||||
<Setter Property="FontSize"
|
||||
Value="{StaticResource HeadFontSize}" />
|
||||
</ControlTheme>
|
||||
|
||||
<ControlTheme x:Key="TextBlockSubTitle"
|
||||
BasedOn="{StaticResource TextBlockBaseStyle}"
|
||||
TargetType="TextBlock">
|
||||
<Setter Property="FontSize"
|
||||
Value="{StaticResource SubHeadFontSize}" />
|
||||
</ControlTheme>
|
||||
|
||||
<ControlTheme x:Key="TextBlockBoldBaseStyle"
|
||||
BasedOn="{StaticResource TextBlockBaseStyle}"
|
||||
TargetType="TextBlock">
|
||||
<Setter Property="FontWeight"
|
||||
Value="Bold" />
|
||||
</ControlTheme>
|
||||
|
||||
<ControlTheme x:Key="TextBlockLargeBold"
|
||||
BasedOn="{StaticResource TextBlockBoldBaseStyle}"
|
||||
TargetType="TextBlock">
|
||||
<Setter Property="FontSize"
|
||||
Value="{StaticResource LargeFontSize}" />
|
||||
</ControlTheme>
|
||||
|
||||
<ControlTheme x:Key="TextBlockTitleBold"
|
||||
BasedOn="{StaticResource TextBlockBoldBaseStyle}"
|
||||
TargetType="TextBlock">
|
||||
<Setter Property="FontSize"
|
||||
Value="{StaticResource HeadFontSize}" />
|
||||
</ControlTheme>
|
||||
|
||||
<ControlTheme x:Key="TextBlockSubTitleBold"
|
||||
BasedOn="{StaticResource TextBlockBoldBaseStyle}"
|
||||
TargetType="TextBlock">
|
||||
<Setter Property="FontSize"
|
||||
Value="{StaticResource SubHeadFontSize}" />
|
||||
</ControlTheme>
|
||||
|
||||
<ControlTheme x:Key="TextBlockDefaultBold"
|
||||
BasedOn="{StaticResource TextBlockBoldBaseStyle}"
|
||||
TargetType="TextBlock" />
|
||||
</ResourceDictionary>
|
||||
@@ -1,15 +1,44 @@
|
||||
<Styles xmlns="https://github.com/avaloniaui"
|
||||
<!-- ReSharper disable once Xaml.RedundantNamespaceAlias -->
|
||||
<Styles xmlns="https://github.com/avaloniaui"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
x:Class="HandyControl.Themes.Theme">
|
||||
x:Class="HandyControl.Themes.Theme"
|
||||
xmlns:hc="clr-namespace:HandyControl.Controls">
|
||||
<Styles.Resources>
|
||||
<ResourceDictionary>
|
||||
<ResourceDictionary.MergedDictionaries>
|
||||
<MergeResourceInclude Source="/Themes/Basic/Colors.axaml" />
|
||||
<MergeResourceInclude Source="/Themes/Basic/Sizes.axaml" />
|
||||
<MergeResourceInclude Source="/Themes/Basic/Fonts.axaml" />
|
||||
<MergeResourceInclude Source="/Themes/Basic/Effects.axaml" />
|
||||
<MergeResourceInclude Source="/Themes/Basic/Geometries.axaml" />
|
||||
<MergeResourceInclude Source="/Themes/Basic/Paths.axaml" />
|
||||
<MergeResourceInclude Source="/Themes/Basic/Brushes.axaml" />
|
||||
<MergeResourceInclude Source="/Themes/Basic/Converters.axaml" />
|
||||
|
||||
<MergeResourceInclude Source="/Themes/Styles/TextBlock.axaml" />
|
||||
<MergeResourceInclude Source="/Themes/Styles/ContentControl.axaml" />
|
||||
<MergeResourceInclude Source="/Themes/Styles/UserControl.axaml" />
|
||||
<MergeResourceInclude Source="/Themes/Styles/Window.axaml" />
|
||||
<MergeResourceInclude Source="/Themes/Styles/Button.axaml" />
|
||||
<MergeResourceInclude Source="/Themes/Styles/RepeatButton.axaml" />
|
||||
<MergeResourceInclude Source="/Themes/Styles/ToggleButton.axaml" />
|
||||
<MergeResourceInclude Source="/Themes/Styles/RadioButton.axaml" />
|
||||
<MergeResourceInclude Source="/Themes/Styles/CheckBox.axaml" />
|
||||
<MergeResourceInclude Source="/Themes/Styles/Border.axaml" />
|
||||
<MergeResourceInclude Source="/Themes/Styles/ItemsControl.axaml" />
|
||||
<MergeResourceInclude Source="/Themes/Styles/TabItem.axaml" />
|
||||
<MergeResourceInclude Source="/Themes/Styles/TabControl.axaml" />
|
||||
<MergeResourceInclude Source="/Themes/Styles/ListBoxItem.axaml" />
|
||||
<MergeResourceInclude Source="/Themes/Styles/ScrollViewer.axaml" />
|
||||
<MergeResourceInclude Source="/Themes/Styles/ListBox.axaml" />
|
||||
<MergeResourceInclude Source="/Themes/Styles/Label.axaml" />
|
||||
<MergeResourceInclude Source="/Themes/Styles/Slider.axaml" />
|
||||
</ResourceDictionary.MergedDictionaries>
|
||||
</ResourceDictionary>
|
||||
</Styles.Resources>
|
||||
|
||||
<StyleInclude Source="/Themes/Styles/Style.axaml" />
|
||||
<Style Selector=":is(UserControl)">
|
||||
<Setter Property="Theme"
|
||||
Value="{DynamicResource {x:Type UserControl}}" />
|
||||
</Style>
|
||||
</Styles>
|
||||
@@ -7,4 +7,4 @@
|
||||
<system:Double x:Key="SubHeadFontSize">16</system:Double>
|
||||
<system:Double x:Key="TextFontSize">12</system:Double>
|
||||
|
||||
</ResourceDictionary>
|
||||
</ResourceDictionary>
|
||||
Reference in new issue
Block a user