Skip to content

Commit e5d0c3d

Browse files
corvinszKeboo
andauthored
Prefer TemplateBinding over Binding with RelativeSource (#3930)
* Prefer TemplateBinding over Binding with RelativeSource * Updates Expander control template Changes `ContentSite` border to be unnamed and binds `ExpandDirection` directly from the `TemplateBinding`. --------- Co-authored-by: Kevin Bost <kitokeboo@gmail.com>
1 parent 486d73a commit e5d0c3d

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/MaterialDesignThemes.Wpf/Themes/MaterialDesignTheme.Expander.xaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -303,11 +303,11 @@
303303
Opacity="0.87"
304304
TextElement.FontSize="{TemplateBinding wpf:ExpanderAssist.HeaderFontSize}" />
305305

306-
<Border Name="ContentSite">
306+
<Border>
307307
<Border.LayoutTransform>
308308
<TransformGroup>
309309
<ScaleTransform x:Name="ContentSiteScaleTransform" />
310-
<RotateTransform Angle="{Binding Path=ExpandDirection, RelativeSource={RelativeSource AncestorType=Expander}, Converter={x:Static convertersInternal:ExpanderRotateAngleConverter.Instance}}" />
310+
<RotateTransform Angle="{TemplateBinding ExpandDirection, Converter={x:Static convertersInternal:ExpanderRotateAngleConverter.Instance}}" />
311311
</TransformGroup>
312312
</Border.LayoutTransform>
313313

@@ -316,7 +316,7 @@
316316
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
317317
VerticalAlignment="{TemplateBinding VerticalContentAlignment}">
318318
<Grid.LayoutTransform>
319-
<RotateTransform Angle="{Binding Path=ExpandDirection, RelativeSource={RelativeSource AncestorType=Expander}, Converter={x:Static convertersInternal:ExpanderRotateAngleConverter.Instance}, ConverterParameter=-1}" />
319+
<RotateTransform Angle="{TemplateBinding ExpandDirection, Converter={x:Static convertersInternal:ExpanderRotateAngleConverter.Instance}, ConverterParameter=-1}" />
320320
</Grid.LayoutTransform>
321321

322322
<ContentPresenter Name="PART_Content"

0 commit comments

Comments
 (0)