Skip to content

Commit

Permalink
Dialogs alert style fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
flarive committed Dec 4, 2023
1 parent f3b6b6f commit b91ea68
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 14 deletions.
4 changes: 2 additions & 2 deletions Avalonia.Themes.Neumorphism/Dialogs/Enums/DialogIconKind.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@
{
public enum DialogIconKind
{
Blocked,
Error,
Success,
Info,
Warning,
Help,
Issues,
Stop,
Blocked
Stop
}
}
15 changes: 8 additions & 7 deletions Avalonia.Themes.Neumorphism/Dialogs/Icons/DialogIconStyle.axaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,20 +9,21 @@
<Setter Property="Template">
<Setter.Value>
<ControlTemplate>
<!--<Viewbox Stretch="Uniform" StretchDirection="Both"
<Viewbox Stretch="Uniform"
ClipToBounds="True"
HorizontalAlignment="Stretch"
VerticalAlignment="Stretch">
<Path Name="PATH_DialogIconVectorPath"
<Path Name="PATH_DialogIconVectorPath" Margin="{TemplateBinding Margin}"
Data="{TemplateBinding Data}"
Fill="{TemplateBinding Foreground}" />
</Viewbox>-->

<controls:SkiaGeometry HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Margin="0"
</Viewbox>


<!--<controls:SkiaGeometry HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Margin="0"
Stretch="Uniform"
Path="{TemplateBinding DataPath}"
ClipToBounds="True"
Fill="{TemplateBinding Foreground}">
Fill="{TemplateBinding Foreground}">-->
<!--<controls:SkiaGeometry.Resources>
<converters:CustomBoxShadowsConverter x:Key="CustomBoxShadowsConverter"/>
<system:String x:Key="BoxShadowsTemplate">-5 -5 20 {MaterialDesignShadowLight}, 5 5 20 {MaterialDesignShadowDark}</system:String>
Expand All @@ -34,7 +35,7 @@
<DynamicResource ResourceKey="MaterialDesignShadowDark" />
</MultiBinding>
</controls:SkiaGeometry.BoxShadow>-->
</controls:SkiaGeometry>
<!--</controls:SkiaGeometry>-->
</ControlTemplate>
</Setter.Value>
</Setter>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,29 @@
<WrapPanel Orientation="Horizontal"/>
</ItemsPanelTemplate>

<RecyclingElementFactory x:Key="DialogHeaderIconTemplate" SelectTemplateKey="DialogHeaderIconTemplate_OnSelectTemplateKey">
<RecyclingElementFactory x:Key="DialogHeaderIconTemplateIcon" SelectTemplateKey="DialogHeaderIconTemplate_OnSelectTemplateKey">
<RecyclingElementFactory.Templates>
<DataTemplate DataType="icons:DialogIconViewModel" x:Key="DialogIcon">
<icons1:DialogIcon Kind="{CompiledBinding Kind}"/>
<icons1:DialogIcon Kind="{CompiledBinding Kind}" Margin="-1.4,-1.4,0,0" HorizontalAlignment="Center" VerticalAlignment="Center"/>
</DataTemplate>

<DataTemplate DataType="icons:ImageIconViewModel" x:Key="DialogImageIcon">
<Image Source="{CompiledBinding Bitmap}" Stretch="{CompiledBinding Stretch}"/>
</DataTemplate>
</RecyclingElementFactory.Templates>
</RecyclingElementFactory>

<RecyclingElementFactory x:Key="DialogHeaderIconTemplate" SelectTemplateKey="DialogHeaderIconTemplate_OnSelectTemplateKey">
<RecyclingElementFactory.Templates>
<DataTemplate DataType="icons:DialogIconViewModel" x:Key="DialogIcon">
<icons1:DialogIcon Kind="{CompiledBinding Kind}" UseRecommendColor="True" />
</DataTemplate>

<DataTemplate DataType="icons:ImageIconViewModel" x:Key="DialogImageIcon">
<Image Source="{CompiledBinding Bitmap}" Stretch="{CompiledBinding Stretch}"/>
</DataTemplate>
</RecyclingElementFactory.Templates>
</RecyclingElementFactory>

<DataTemplate x:Key="DialogButtonTemplate" DataType="elements:DialogButtonViewModel">
<Button Height="32" Width="NaN" Margin="20" FontWeight="Normal" Background="{DynamicResource MaterialDesignPaper}"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:viewModels="clr-namespace:Avalonia.Themes.Neumorphism.Dialogs.ViewModels"
xmlns:controls="clr-namespace:Avalonia.Themes.Neumorphism.Dialogs.Controls"
xmlns:controls2="clr-namespace:Avalonia.Themes.Neumorphism.Controls"
xmlns:assist="clr-namespace:Avalonia.Themes.Neumorphism.Assist"
xmlns:naming="clr-namespace:Avalonia.Themes.Neumorphism.Resources.Naming">

Expand Down Expand Up @@ -34,11 +35,15 @@
<DockPanel Name="{x:Static naming:PartNames.PartHeaderPanel}">

<Button Theme="{StaticResource ButtonIcon}" Width="90" Height="90" IsHitTestVisible="False" HorizontalContentAlignment="Center" VerticalContentAlignment="Center">

<ContentPresenter Name="{x:Static naming:PartNames.PartHeaderIcon}"
Content="{CompiledBinding DialogIcon}"
ContentTemplate="{StaticResource DialogHeaderIconTemplate}"
ContentTemplate="{StaticResource DialogHeaderIconTemplateIcon}"
IsVisible="{CompiledBinding !!DialogIcon}"/>


</Button>


<StackPanel Orientation="Vertical">
<TextBlock Name="{x:Static naming:PartNames.PartHeaderText}" Foreground="{DynamicResource MaterialDesignDarkGray}"
Expand All @@ -52,7 +57,13 @@
</StackPanel>
</DockPanel>

<DockPanel Name="{x:Static naming:PartNames.PartButtonsPanel}">

<controls2:ColorZone VerticalAlignment="Top" HorizontalAlignment="Stretch" Margin="0,15,0,0"
assist:ShadowAssist.ShadowDepth="Depth5" Padding="0"
Mode="Standard" Background="Transparent">

<DockPanel Name="{x:Static naming:PartNames.PartButtonsPanel}" Margin="0">

<ItemsControl Name="{x:Static naming:PartNames.PartLeftButtonPlacement}" IsVisible="{Binding !!LeftDialogButtons.Count}"
DockPanel.Dock="Left" HorizontalAlignment="Left"
ItemsSource="{CompiledBinding LeftDialogButtons}"
Expand All @@ -70,7 +81,10 @@
ItemsSource="{CompiledBinding RightDialogButtons}"
ItemTemplate="{StaticResource DialogButtonTemplate}"
ItemsPanel="{StaticResource DialogButtonPlacementPanel}" />
</DockPanel>

</DockPanel>
</controls2:ColorZone>

</DockPanel>
</Border>
</ControlTemplate>
Expand Down

0 comments on commit b91ea68

Please sign in to comment.