Skip to content

Commit a7d4ed2

Browse files
authored
Add TemplateBinding for ClipToBounds to ColorZone (#2058)
1 parent 13632d0 commit a7d4ed2

File tree

2 files changed

+9
-5
lines changed

2 files changed

+9
-5
lines changed

MainDemo.Wpf/ColorZones.xaml

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -109,12 +109,15 @@
109109
</materialDesign:ColorZone>
110110
</smtx:XamlDisplay>
111111

112-
<TextBlock Margin="0 16 0 0" Style="{StaticResource MaterialDesignSubtitle1TextBlock}">Use custom back and fore colours.</TextBlock>
113-
<smtx:XamlDisplay Key="color_zones_custom">
114-
<materialDesign:ColorZone Mode="Custom" Background="Black" Foreground="White" Padding="16">
112+
<TextBlock Margin="0 16 0 0" Style="{StaticResource MaterialDesignSubtitle1TextBlock}">Use custom back and fore colours. Disabled ClipToBounds</TextBlock>
113+
<smtx:XamlDisplay Key="color_zones_custom" Margin="0 16">
114+
<materialDesign:ColorZone Mode="Custom" Background="Black" Foreground="White" Padding="16 0" ClipToBounds="False">
115115
<StackPanel Orientation="Horizontal">
116116
<ToggleButton Style="{DynamicResource MaterialDesignHamburgerToggleButton}" />
117-
<TextBlock VerticalAlignment="Center" Margin="16 0 0 0">Material Design In XAML Toolkit</TextBlock>
117+
<TextBlock VerticalAlignment="Center" Margin="16 0">Material Design In XAML Toolkit</TextBlock>
118+
<materialDesign:Badged Badge="123" VerticalAlignment="Center">
119+
<Button>Some action</Button>
120+
</materialDesign:Badged>
118121
</StackPanel>
119122
</materialDesign:ColorZone>
120123
</smtx:XamlDisplay>

MaterialDesignThemes.Wpf/Themes/Generic.xaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -425,6 +425,7 @@
425425
<Setter Property="VerticalContentAlignment" Value="Stretch" />
426426
<Setter Property="VerticalAlignment" Value="Top" />
427427
<Setter Property="IsTabStop" Value="False" />
428+
<Setter Property="ClipToBounds" Value="True" />
428429
<Setter Property="Template">
429430
<Setter.Value>
430431
<ControlTemplate TargetType="{x:Type local:ColorZone}">
@@ -447,7 +448,7 @@
447448
BorderBrush="{TemplateBinding BorderBrush}"
448449
BorderThickness="{TemplateBinding BorderThickness}"
449450
CornerRadius="{TemplateBinding CornerRadius}"
450-
ClipToBounds="True">
451+
ClipToBounds="{TemplateBinding ClipToBounds}">
451452
<ContentPresenter Content="{TemplateBinding Content}"
452453
ContentTemplate="{TemplateBinding ContentTemplate}"
453454
TextElement.Foreground="{TemplateBinding Foreground}"

0 commit comments

Comments
 (0)