WPF 模板绑定父级控件内容

<Style TargetType="Button" x:Key="btn">
    <Setter Property="Template">
        <Setter.Value>
            <ControlTemplate TargetType="Button">
                <Label Content="{Binding Path=Content,RelativeSource={ RelativeSource Mode=TemplatedParent}}"></Label>
            </ControlTemplate>
        </Setter.Value>
    </Setter>
</Style>

 

相关文章:

  • 2021-09-22
  • 2022-12-23
  • 2021-07-27
  • 2022-12-23
  • 2022-01-21
  • 2022-12-23
  • 2021-12-03
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2021-09-22
  • 2022-12-23
  • 2021-12-13
  • 2022-12-23
相关资源
相似解决方案