Skip to content

Commit

Permalink
Adding BackDrop
Browse files Browse the repository at this point in the history
  • Loading branch information
batzen committed May 11, 2024
1 parent 109ec54 commit 80d9415
Show file tree
Hide file tree
Showing 4 changed files with 48 additions and 2 deletions.
20 changes: 20 additions & 0 deletions src/MahApps.Metro.Samples/MahApps.Metro.Demo/MainWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,14 @@
<x:Type TypeName="controlzEx:WindowCornerPreference" />
</ObjectDataProvider.MethodParameters>
</ObjectDataProvider>

<ObjectDataProvider x:Key="WindowBackdropTypeEnumValues"
MethodName="GetValues"
ObjectType="{x:Type controlzEx:WindowBackdropType}">
<ObjectDataProvider.MethodParameters>
<x:Type TypeName="controlzEx:WindowBackdropType" />
</ObjectDataProvider.MethodParameters>
</ObjectDataProvider>
</ResourceDictionary>
</Window.Resources>

Expand Down Expand Up @@ -238,6 +246,18 @@
</ControlTemplate>
</MenuItem.Template>
</MenuItem>
<MenuItem>
<MenuItem.Template>
<ControlTemplate>
<StackPanel Orientation="Horizontal">
<Label Content="Backdrop" />
<ComboBox VerticalAlignment="Center"
ItemsSource="{Binding Source={StaticResource WindowBackdropTypeEnumValues}}"
SelectedItem="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type mah:MetroWindow}}, Path=(controlzEx:WindowBackdropManager.BackdropType), Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" />
</StackPanel>
</ControlTemplate>
</MenuItem.Template>
</MenuItem>
</MenuItem>
<MenuItem Header="Glow">
<MenuItem Header="PreferDWMBorderColor"
Expand Down
8 changes: 6 additions & 2 deletions src/MahApps.Metro/Styles/Themes/GeneratorParameters.json
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,9 @@
"MahApps.Brushes.SystemControlHighlightListAccentHigh.Opacity": "0.9",
"MahApps.Brushes.SystemControlHighlightListAccentLow.Opacity": "0.6",
"MahApps.Brushes.SystemControlHighlightListAccentMedium.Opacity": "0.8",
"MahApps.Brushes.SystemControlTransientBorder.Opacity": "0.36"
"MahApps.Brushes.SystemControlTransientBorder.Opacity": "0.36",
"MahApps.Brushes.Window.Background.Backdrop.Acrylic": "#60000000",
"MahApps.Brushes.Window.Background.Backdrop.Auto": "#BB000000"
}
},
{
Expand Down Expand Up @@ -153,7 +155,9 @@
"MahApps.Brushes.SystemControlHighlightListAccentHigh.Opacity": "0.7",
"MahApps.Brushes.SystemControlHighlightListAccentLow.Opacity": "0.4",
"MahApps.Brushes.SystemControlHighlightListAccentMedium.Opacity": "0.6",
"MahApps.Brushes.SystemControlTransientBorder.Opacity": "0.14"
"MahApps.Brushes.SystemControlTransientBorder.Opacity": "0.14",
"MahApps.Brushes.Window.Background.Backdrop.Acrylic": "#60FFFFFF",
"MahApps.Brushes.Window.Background.Backdrop.Auto": "#BBFFFFFF"
}
}
],
Expand Down
2 changes: 2 additions & 0 deletions src/MahApps.Metro/Styles/Themes/Theme.Template.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,8 @@

<SolidColorBrush x:Key="MahApps.Brushes.Window.FlyoutOverlay" Opacity="0.5" Color="{StaticResource MahApps.Colors.ThemeForeground}" options:Freeze="True" />
<SolidColorBrush x:Key="MahApps.Brushes.Window.Background" Color="{StaticResource MahApps.Colors.ThemeBackground}" options:Freeze="True" />
<SolidColorBrush x:Key="MahApps.Brushes.Window.Background.Backdrop.Acrylic" Color="{{MahApps.Brushes.Window.Background.Backdrop.Acrylic}}" options:Freeze="True" />
<SolidColorBrush x:Key="MahApps.Brushes.Window.Background.Backdrop.Auto" Color="{{MahApps.Brushes.Window.Background.Backdrop.Auto}}" options:Freeze="True" />
<SolidColorBrush x:Key="MahApps.Brushes.Separator" Color="#FFC4C4C5" options:Freeze="True" />

<SolidColorBrush x:Key="MahApps.Brushes.Button.Flat.Background" Color="#D5D5D5" options:Freeze="True" />
Expand Down
20 changes: 20 additions & 0 deletions src/MahApps.Metro/Themes/MetroWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -574,6 +574,7 @@
</Setter.Value>
</Setter>
<Setter Property="WindowTitleBrush" Value="{DynamicResource MahApps.Brushes.WindowTitle}" />
<Setter Property="controlzEx:WindowBackdropManager.BackdropType" Value="Mica" />
<Style.Triggers>
<DataTrigger Binding="{Binding RelativeSource={RelativeSource Self}, Path=Icon, Mode=OneWay, Converter={x:Static mahConverters:IsNullConverter.Instance}}" Value="False">
<Setter Property="IconTemplate">
Expand All @@ -592,6 +593,25 @@
<Trigger Property="TitleAlignment" Value="Center">
<Setter Property="Template" Value="{StaticResource MahApps.Templates.MetroWindow.Center}" />
</Trigger>
<Trigger Property="UseNativeCaptionButtons" Value="True">
<Setter Property="GlassFrameThickness" Value="-1" />
</Trigger>
<Trigger Property="controlzEx:WindowBackdropManager.CurrentBackdropType" Value="Acrylic">
<Setter Property="Background" Value="{DynamicResource MahApps.Brushes.Window.Background.Backdrop.Acrylic}" />
<Setter Property="GlassFrameThickness" Value="-1" />
</Trigger>
<Trigger Property="controlzEx:WindowBackdropManager.CurrentBackdropType" Value="Auto">
<Setter Property="Background" Value="{DynamicResource MahApps.Brushes.Window.Background.Backdrop.Auto}" />
<Setter Property="GlassFrameThickness" Value="-1" />
</Trigger>
<Trigger Property="controlzEx:WindowBackdropManager.CurrentBackdropType" Value="Mica">
<Setter Property="Background" Value="Transparent" />
<Setter Property="GlassFrameThickness" Value="-1" />
</Trigger>
<Trigger Property="controlzEx:WindowBackdropManager.CurrentBackdropType" Value="Tabbed">
<Setter Property="Background" Value="Transparent" />
<Setter Property="GlassFrameThickness" Value="-1" />
</Trigger>
</Style.Triggers>
</Style>
</ResourceDictionary>

0 comments on commit 80d9415

Please sign in to comment.