Browse Source

Improved PixiEditorPopupTemplate

Krzysztof Krysiński 1 year ago
parent
commit
ba20d6d651

+ 11 - 1
src/PixiEditor.AvaloniaUI/Styles/PixiEditorPopupTemplate.axaml

@@ -12,6 +12,10 @@
         <Setter Property="ExtendClientAreaChromeHints" Value="NoChrome" />
         <Setter Property="ExtendClientAreaToDecorationsHint" Value="True" />
         <Setter Property="ExtendClientAreaTitleBarHeightHint" Value="36" />
+        <Setter Property="FontFamily" Value="{DynamicResource ContentControlThemeFontFamily}" />
+        <Setter Property="Background" Value="{DynamicResource ThemeBackgroundBrush}" />
+        <Setter Property="Foreground" Value="{DynamicResource ThemeForegroundBrush}" />
+        <Setter Property="FontSize" Value="{DynamicResource FontSizeNormal}" />
         <Setter Property="ShowInTaskbar" Value="False"/>
         <Setter Property="Template">
             <ControlTemplate>
@@ -26,7 +30,13 @@
                             <behaviours:ClearFocusOnClickBehavior/>
                         </Interaction.Behaviors>
                         
-                        <ContentPresenter DockPanel.Dock="Bottom" Background="{DynamicResource ThemeBackgroundBrush}" Content="{TemplateBinding Content}" />
+                        <ContentPresenter DockPanel.Dock="Bottom"
+                                          Name="PART_ContentPresenter"
+                                          Margin="{TemplateBinding Padding}"
+                                          HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}"
+                                          VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}"
+                                          Content="{TemplateBinding Content}"
+                                          ContentTemplate="{TemplateBinding ContentTemplate}"  />
                     </Grid>
                 </DockPanel>
             </ControlTemplate>

+ 6 - 13
src/PixiEditor.AvaloniaUI/Views/Windows/Settings/SettingsWindow.axaml

@@ -1,4 +1,4 @@
-<Window
+<dialogs:PixiEditorPopup
     xmlns="https://github.com/avaloniaui"
     xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
     xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
@@ -24,25 +24,17 @@
     MinWidth="665" MinHeight="500"
     DataContext="{DynamicResource SettingsWindowViewModel}"
     BorderBrush="Black" BorderThickness="1"
-    FlowDirection="{markupExtensions:Localization FlowDirection}"
-    ui:Translator.Key="SETTINGS">
+    Title="SETTINGS">
 
     <Window.Resources>
         <vm:SettingsWindowViewModel x:Key="SettingsWindowViewModel"/>
     </Window.Resources>
 
     <DockPanel>
-        <dialogs:DialogTitleBar 
-            DockPanel.Dock="Top"
-            TitleKey="SETTINGS"/>
         <DockPanel Focusable="True" Background="{DynamicResource ThemeBackgroundBrush}">
-            <i:Interaction.Behaviors>
-                <behaviours:ClearFocusOnClickBehavior/>
-            </i:Interaction.Behaviors>
-            
             <ListBox DockPanel.Dock="Left" x:Name="pages" ItemsSource="{Binding Pages}"
                      Margin="0, 8"
-                     Background="{DynamicResource ThemeBackgroundBrush}" 
+                     Background="{DynamicResource ThemeBackgroundBrush}"
                      MinWidth="165"
                      SelectedIndex="{Binding CurrentPage}">
                 <ListBox.ItemTemplate>
@@ -73,7 +65,7 @@
                                 </Binding.ConverterParameter>
                             </Binding>
                         </controls:FixedSizeStackPanel.IsVisible>
-                        
+
                         <TextBlock ui:Translator.Key="LANGUAGE" Classes="h5"/>
                         <ComboBox Classes="leftOffset" Width="200" HorizontalAlignment="Left"
                                   ItemsSource="{Binding SettingsSubViewModel.General.AvailableLanguages}"
@@ -261,4 +253,5 @@
         </DockPanel>
     </DockPanel>
 
-</Window>
+</dialogs:PixiEditorPopup>
+

+ 2 - 1
src/PixiEditor.AvaloniaUI/Views/Windows/Settings/SettingsWindow.axaml.cs

@@ -1,9 +1,10 @@
 using Avalonia.Controls;
 using PixiEditor.AvaloniaUI.ViewModels;
+using PixiEditor.AvaloniaUI.Views.Dialogs;
 
 namespace PixiEditor.AvaloniaUI.Views.Windows.Settings;
 
-public partial class SettingsWindow : Window
+public partial class SettingsWindow : PixiEditorPopup
 {
     public SettingsWindow(int page = 0)
     {