Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions src/MaterialDesignThemes.Wpf/Converters/DrawerOffsetConverter.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using System.Globalization;
using System.Globalization;
using System.Windows.Data;

namespace MaterialDesignThemes.Wpf.Converters;
Expand All @@ -14,10 +14,10 @@ public object Convert(object value, Type targetType, object parameter, CultureIn
Dock dock = (parameter is Dock) ? (Dock)parameter : Dock.Left;
return dock switch
{
Dock.Top => new Thickness(0, 0 - d, 0, 0),
Dock.Bottom => new Thickness(0, 0, 0, 0 - d),
Dock.Right => new Thickness(0, 0, 0 - d, 0),
_ => (object)new Thickness(0 - d, 0, 0, 0),
Dock.Top => new Thickness(0, -d, 0, 0),
Dock.Bottom => new Thickness(0, 0, 0, -d),
Dock.Right => new Thickness(0, 0, -d, 0),
_ => new Thickness(-d, 0, 0, 0),
};
}

Expand Down
9 changes: 9 additions & 0 deletions src/MaterialDesignThemes.Wpf/DrawerHost.cs
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,15 @@ public Brush? OverlayBackground
set => SetValue(OverlayBackgroundProperty, value);
}

public static readonly DependencyProperty CornerRadiusProperty = DependencyProperty.Register(
nameof(CornerRadius), typeof(CornerRadius), typeof(DrawerHost), new PropertyMetadata(default(CornerRadius)));

public CornerRadius CornerRadius
{
get => (CornerRadius)GetValue(CornerRadiusProperty);
set => SetValue(CornerRadiusProperty, value);
}

public DrawerHostOpenMode OpenMode
{
get => (DrawerHostOpenMode)GetValue(OpenModeProperty);
Expand Down
33 changes: 19 additions & 14 deletions src/MaterialDesignThemes.Wpf/Themes/Generic.xaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:converters="clr-namespace:MaterialDesignThemes.Wpf.Converters"
xmlns:local="clr-namespace:MaterialDesignThemes.Wpf"
Expand All @@ -12,7 +12,7 @@
as part of Material Design in XAML Toolkit. Other themes, for existing controls
must be selected manually by the user, so that they override default styles.
The easiest way to do this is include:

MaterialDesignTheme.Defaults.xaml
in your App.xaml
-->
Expand Down Expand Up @@ -953,16 +953,17 @@
</ContentPresenter.Tag>
</ContentPresenter>
</AdornerDecorator>
<Grid x:Name="PART_ContentCover"
Grid.Row="0"
Grid.RowSpan="3"
Grid.Column="0"
Grid.ColumnSpan="3"
Focusable="False"
IsHitTestVisible="False"
Opacity="0">
<Grid.Style>
<Style TargetType="Grid">
<Border x:Name="PART_ContentCover"
Grid.Row="0"
Grid.RowSpan="3"
Grid.Column="0"
Grid.ColumnSpan="3"
CornerRadius="{TemplateBinding CornerRadius}"
Focusable="False"
IsHitTestVisible="False"
Opacity="0">
<Border.Style>
<Style TargetType="Border">
<Setter Property="Background" Value="{Binding OverlayBackground, RelativeSource={RelativeSource TemplatedParent}}" />
<Style.Triggers>
<DataTrigger Binding="{Binding OpenMode, RelativeSource={RelativeSource TemplatedParent}}" Value="Standard">
Expand All @@ -973,8 +974,8 @@
</Trigger>
</Style.Triggers>
</Style>
</Grid.Style>
</Grid>
</Border.Style>
</Border>
<Grid x:Name="PART_LeftDrawer"
Margin="{Binding RelativeSource={RelativeSource Self}, Path=ActualWidth, Converter={x:Static converters:DrawerOffsetConverter.Instance}, ConverterParameter={x:Static Dock.Left}}"
HorizontalAlignment="Left"
Expand All @@ -999,6 +1000,7 @@
<Border x:Name="LeftDrawerShadow"
Background="{TemplateBinding LeftDrawerBackground}"
CornerRadius="{TemplateBinding LeftDrawerCornerRadius}"
Margin="-1,-1,0,-1"
Opacity="0">
<Border.Style>
<Style TargetType="Border">
Expand Down Expand Up @@ -1041,6 +1043,7 @@
<Border x:Name="RightDrawerShadow"
Background="{TemplateBinding RightDrawerBackground}"
CornerRadius="{TemplateBinding RightDrawerCornerRadius}"
Margin="0,-1,-1,-1"
Opacity="0">
<Border.Style>
<Style TargetType="Border">
Expand Down Expand Up @@ -1083,6 +1086,7 @@
<Border x:Name="TopDrawerShadow"
Background="{TemplateBinding TopDrawerBackground}"
CornerRadius="{TemplateBinding TopDrawerCornerRadius}"
Margin="-1,-1,-1,0"
Opacity="0">
<Border.Style>
<Style TargetType="Border">
Expand Down Expand Up @@ -1125,6 +1129,7 @@
<Border x:Name="BottomDrawerShadow"
Background="{TemplateBinding BottomDrawerBackground}"
CornerRadius="{TemplateBinding BottomDrawerCornerRadius}"
Margin="-1,0,-1,-1"
Opacity="0">
<Border.Style>
<Style TargetType="Border">
Expand Down
Loading