Added PersonPicture

This commit is contained in:
TheXamlGuy
2024-05-09 19:09:18 +01:00
parent ee7083d009
commit 711353c8e9
19 changed files with 1108 additions and 0 deletions
@@ -0,0 +1,75 @@
<ResourceDictionary
xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:controls="using:Toolkit.UI.Controls.Avalonia">
<x:Double x:Key="PersonPictureEllipseBadgeStrokeOpacity">1</x:Double>
<x:Double x:Key="PersonPictureEllipseBadgeImageSourceStrokeOpacity">1</x:Double>
<x:Double x:Key="PersonPictureEllipseStrokeThickness">1</x:Double>
<x:Double x:Key="PersonPictureEllipseBadgeStrokeThickness">2</x:Double>
<Thickness x:Key="PersonPictureBadgeGridMargin">0,-4,-4,0</Thickness>
<ControlTheme x:Key="{x:Type controls:PersonPicture}" TargetType="controls:PersonPicture">
<Setter Property="Foreground" Value="{DynamicResource PersonPictureForegroundThemeBrush}" />
<Setter Property="Width" Value="100" />
<Setter Property="Height" Value="100" />
<Setter Property="FontFamily" Value="{DynamicResource ContentControlThemeFontFamily}" />
<Setter Property="FontWeight" Value="350" />
<Setter Property="IsTabStop" Value="False" />
<Setter Property="Template">
<ControlTemplate>
<Grid x:Name="RootGrid">
<Ellipse
Width="{TemplateBinding Width}"
Height="{TemplateBinding Height}"
Fill="{DynamicResource PersonPictureEllipseFillThemeBrush}"
Stroke="{DynamicResource PersonPictureEllipseFillStrokeBrush}"
StrokeThickness="{DynamicResource PersonPictureEllipseStrokeThickness}" />
<TextBlock
x:Name="InitialsTextBlock"
HorizontalAlignment="Center"
VerticalAlignment="Center"
FontFamily="{TemplateBinding FontFamily}"
FontSize="40"
FontWeight="{TemplateBinding FontWeight}"
Foreground="{TemplateBinding Foreground}"
Text="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=TemplateSettings.ActualInitials}" />
<Ellipse
x:Name="PersonPictureEllipse"
Width="{TemplateBinding Width}"
Height="{TemplateBinding Height}"
FlowDirection="LeftToRight" />
<Grid
x:Name="BadgeGrid"
Margin="{DynamicResource PersonPictureBadgeGridMargin}"
HorizontalAlignment="Right"
VerticalAlignment="Top"
IsVisible="False">
<Ellipse
x:Name="BadgingBackgroundEllipse"
Fill="{DynamicResource PersonPictureEllipseBadgeFillThemeBrush}"
Opacity="{DynamicResource PersonPictureEllipseBadgeStrokeOpacity}"
Stroke="{DynamicResource PersonPictureEllipseBadgeStrokeThemeBrush}"
StrokeThickness="{DynamicResource PersonPictureEllipseBadgeStrokeThickness}" />
<Ellipse
x:Name="BadgingEllipse"
FlowDirection="LeftToRight"
Opacity="0" />
<TextBlock
x:Name="BadgeNumberTextBlock"
HorizontalAlignment="Center"
VerticalAlignment="Center"
FontFamily="{TemplateBinding FontFamily}"
FontWeight="{TemplateBinding FontWeight}"
Foreground="{DynamicResource PersonPictureEllipseBadgeForegroundThemeBrush}" />
<controls:FontIcon
x:Name="BadgeGlyphIcon"
HorizontalAlignment="Center"
VerticalAlignment="Center"
FontFamily="{DynamicResource SymbolThemeFontFamily}"
FontWeight="{TemplateBinding FontWeight}"
Foreground="{DynamicResource PersonPictureEllipseBadgeForegroundThemeBrush}" />
</Grid>
</Grid>
</ControlTemplate>
</Setter>
</ControlTheme>
</ResourceDictionary>