码迷,mamicode.com
首页 > 其他好文 > 详细

ControlTemplate 中 Bingding 附加属性时需要加入 Path

时间:2019-01-18 20:05:01      阅读:157      评论:0      收藏:0      [点我收藏+]

标签:present   setter   work   ali   col   fonts   ssi   vertica   set   

<Style  TargetType="{x:Type GroupBox}" BasedOn="{StaticResource MaterialDesignGroupBox}">
        <Setter Property="Background" Value="Transparent"/>
        <Setter Property="Foreground" Value="{Binding (TextElement.Foreground), RelativeSource={RelativeSource FindAncestor, AncestorLevel=1, AncestorType={x:Type FrameworkElement}}}"/>
        Property="materialDesignMahApps:ShadowAssist.ShadowDepth" Value="Depth0"/>
        <Setter Property="materialDesignMahApps:ColorZoneAssist.Mode" Value="PrimaryMid"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type GroupBox}">
                   
                    <DockPanel  Background="{TemplateBinding Background}">
                        <materialDesignMahApps:ColorZone Background="{StaticResource PrimaryHueMidBrush}"  x:Name="PART_ColorZone" DockPanel.Dock="Top" Mode="{Binding Path=(materialDesignMahApps:ColorZoneAssist.Mode), RelativeSource={RelativeSource TemplatedParent}}" Padding="{TemplateBinding Padding}" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" materialDesignMahApps:ShadowAssist.ShadowEdges="{Binding  Path=(materialDesignMahApps:ShadowAssist.ShadowEdges), RelativeSource={RelativeSource TemplatedParent}}" UseLayoutRounding="True">
                           
                            <ContentControl  HorizontalAlignment="Left" Foreground="White" VerticalAlignment="Center" FontSize="20" FontWeight="DemiBold" Margin="10 0 0 4"  ContentTemplate="{TemplateBinding HeaderTemplate}" ContentStringFormat="{TemplateBinding HeaderStringFormat}" Content="{TemplateBinding Header}"  SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"/>
                        </materialDesignMahApps:ColorZone>
                        <ContentPresenter ContentTemplate="{TemplateBinding ContentTemplate}" Content="{TemplateBinding Content}" ContentStringFormat="{TemplateBinding ContentStringFormat}" Margin="{TemplateBinding Padding}" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"/>
                    </DockPanel>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

 

ControlTemplate 中 Bingding 附加属性时需要加入 Path

标签:present   setter   work   ali   col   fonts   ssi   vertica   set   

原文地址:https://www.cnblogs.com/aguan/p/10289073.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!