Skip to content
This repository has been archived by the owner on Apr 15, 2021. It is now read-only.

Commit

Permalink
Fix avatar control
Browse files Browse the repository at this point in the history
  • Loading branch information
x2bool committed Jan 7, 2019
1 parent d1e362a commit 4652e06
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 3 deletions.
9 changes: 7 additions & 2 deletions src/Tel.Egram.Gui.Views/Messenger/Catalog/CatalogControl.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -108,14 +108,19 @@

<Style Selector="ListBoxItem Grid > Border">
<Setter Property="CornerRadius" Value="14,0,0,14" />
<Setter Property="Padding" Value="3,0,8,0" />
</Style>

<Style Selector="ListBoxItem:selected Grid > Border">
<Setter Property="Background" Value="#435270" />
</Style>

<Style Selector="ListBoxItem Panel">
<Setter Property="Margin" Value="4,3,8,3"/>
<Style Selector="ListBoxItem Panel.Title">
<Setter Property="Margin" Value="6,3,2,3"/>
</Style>

<Style Selector="ListBoxItem Panel.Indicator">
<Setter Property="Margin" Value="2,3,8,3"/>
</Style>

<Style Selector="ListBoxItem TextBlock">
Expand Down
3 changes: 2 additions & 1 deletion src/Tel.Egram.Gui.Views/Messenger/Catalog/EntryControl.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@
Color="{Binding Color}"
TextColor="{Binding TextColor}"
Text="{Binding Label}"
Size="22" />
Size="22"
Margin="3,0,0,0"/>

<Panel
Classes="Title"
Expand Down
15 changes: 15 additions & 0 deletions src/Tel.Egram.Gui.Views/Shared/AvatarControl.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,11 @@ private static void SourceChanged(AvaloniaPropertyChangedEventArgs e)
{
if (e.Sender is AvatarControl avatarControl)
{
if (e.NewValue is null)
{
avatarControl.SourceBrush = null;
}

if (e.NewValue is IBitmap bitmap)
{
avatarControl.SourceBrush = new ImageBrush(bitmap);
Expand All @@ -117,6 +122,11 @@ private static void ColorChanged(AvaloniaPropertyChangedEventArgs e)
{
if (e.Sender is AvatarControl avatarControl)
{
if (e.NewValue is null)
{
avatarControl.ColorBrush = null;
}

if (e.NewValue is Color color)
{
avatarControl.ColorBrush = new SolidColorBrush(color);
Expand All @@ -128,6 +138,11 @@ private static void TextColorChanged(AvaloniaPropertyChangedEventArgs e)
{
if (e.Sender is AvatarControl avatarControl)
{
if (e.NewValue is null)
{
avatarControl.TextColorBrush = null;
}

if (e.NewValue is Color color)
{
avatarControl.TextColorBrush = new SolidColorBrush(color);
Expand Down

0 comments on commit 4652e06

Please sign in to comment.