feat: Add Gravatar control and demo.
This commit is contained in:
1 parent
ee5c47a7cd
commit
6c307a6ccc
9 files changed
+329
-17
No files matched your search
@@ -0,0 +1,57 @@
|
||||
<ResourceDictionary xmlns="https://github.com/avaloniaui"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
x:ClassModifier="internal"
|
||||
xmlns:hc="clr-namespace:HandyControl.Controls">
|
||||
|
||||
<ControlTheme x:Key="GravatarBaseStyle"
|
||||
TargetType="hc:Gravatar">
|
||||
<Setter Property="Focusable" Value="False" />
|
||||
<Setter Property="Width" Value="72" />
|
||||
<Setter Property="Height" Value="72" />
|
||||
<Setter Property="Background" Value="{DynamicResource SecondaryRegionBrush}" />
|
||||
<Setter Property="CornerRadius" Value="{StaticResource DefaultCornerRadius}" />
|
||||
<Setter Property="Padding" Value="6" />
|
||||
<Setter Property="Template">
|
||||
<ControlTemplate TargetType="hc:Gravatar">
|
||||
<Border ClipToBounds="True"
|
||||
CornerRadius="{TemplateBinding CornerRadius}"
|
||||
Background="{TemplateBinding Background}"
|
||||
BorderBrush="{TemplateBinding BorderBrush}"
|
||||
BorderThickness="{TemplateBinding BorderThickness}">
|
||||
<ContentPresenter Margin="{TemplateBinding Padding}"
|
||||
Content="{TemplateBinding Content}"
|
||||
ContentTemplate="{TemplateBinding ContentTemplate}" />
|
||||
</Border>
|
||||
</ControlTemplate>
|
||||
</Setter>
|
||||
</ControlTheme>
|
||||
|
||||
<ControlTheme x:Key="{x:Type hc:Gravatar}"
|
||||
BasedOn="{StaticResource GravatarBaseStyle}"
|
||||
TargetType="hc:Gravatar" />
|
||||
|
||||
<ControlTheme x:Key="GravatarCircle"
|
||||
BasedOn="{StaticResource GravatarBaseStyle}"
|
||||
TargetType="hc:Gravatar">
|
||||
<Setter Property="Padding" Value="16" />
|
||||
<Setter Property="Template">
|
||||
<ControlTemplate TargetType="hc:Gravatar">
|
||||
<Border Theme="{StaticResource BorderCircularClip}"
|
||||
Background="{TemplateBinding Background}"
|
||||
BorderBrush="{TemplateBinding BorderBrush}"
|
||||
BorderThickness="{TemplateBinding BorderThickness}">
|
||||
<ContentPresenter Margin="{TemplateBinding Padding}"
|
||||
Content="{TemplateBinding Content}"
|
||||
ContentTemplate="{TemplateBinding ContentTemplate}" />
|
||||
</Border>
|
||||
</ControlTemplate>
|
||||
</Setter>
|
||||
</ControlTheme>
|
||||
|
||||
<ControlTheme x:Key="GravatarCircleImg"
|
||||
BasedOn="{StaticResource GravatarCircle}"
|
||||
TargetType="hc:Gravatar">
|
||||
<Setter Property="Padding" Value="0" />
|
||||
</ControlTheme>
|
||||
|
||||
</ResourceDictionary>
|
||||
@@ -1,4 +1,4 @@
|
||||
<ResourceDictionary xmlns="https://github.com/avaloniaui"
|
||||
<ResourceDictionary xmlns="https://github.com/avaloniaui"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
x:ClassModifier="internal"
|
||||
xmlns:hc="clr-namespace:HandyControl.Controls">
|
||||
@@ -118,4 +118,36 @@
|
||||
<Setter Property="ItemContainerTheme"
|
||||
Value="{StaticResource ListBoxItemBaseStyle.Small}" />
|
||||
</ControlTheme>
|
||||
|
||||
<ControlTheme x:Key="ListBoxItemCustom"
|
||||
TargetType="ListBoxItem">
|
||||
<Setter Property="Padding"
|
||||
Value="0" />
|
||||
<Setter Property="HorizontalContentAlignment"
|
||||
Value="{Binding $parent[ItemsControl].HorizontalContentAlignment}" />
|
||||
<Setter Property="VerticalContentAlignment"
|
||||
Value="Top" />
|
||||
<Setter Property="Background"
|
||||
Value="Transparent" />
|
||||
<Setter Property="BorderBrush"
|
||||
Value="Transparent" />
|
||||
<Setter Property="BorderThickness"
|
||||
Value="0" />
|
||||
<Setter Property="Template">
|
||||
<ControlTemplate>
|
||||
<ContentPresenter Padding="{TemplateBinding Padding}"
|
||||
HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}"
|
||||
VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}"
|
||||
Content="{TemplateBinding Content}"
|
||||
ContentTemplate="{TemplateBinding ContentTemplate}" />
|
||||
</ControlTemplate>
|
||||
</Setter>
|
||||
</ControlTheme>
|
||||
|
||||
<ControlTheme x:Key="ListBoxCustom"
|
||||
BasedOn="{StaticResource ListBoxBaseStyle}"
|
||||
TargetType="ListBox">
|
||||
<Setter Property="ItemContainerTheme"
|
||||
Value="{StaticResource ListBoxItemCustom}" />
|
||||
</ControlTheme>
|
||||
</ResourceDictionary>
|
||||
@@ -60,6 +60,7 @@
|
||||
<MergeResourceInclude Source="avares://HandyControl/Themes/Styles/Card.axaml" />
|
||||
<MergeResourceInclude Source="avares://HandyControl/Themes/Styles/ElementGroup.axaml" />
|
||||
<MergeResourceInclude Source="avares://HandyControl/Themes/Styles/ButtonGroup.axaml" />
|
||||
<MergeResourceInclude Source="avares://HandyControl/Themes/Styles/Gravatar.axaml" />
|
||||
</ResourceDictionary.MergedDictionaries>
|
||||
</ResourceDictionary>
|
||||
</Styles.Resources>
|
||||
|
||||
Reference in new issue
Block a user