WPF 从 Button 继承为 MyUserControl

问题描述 投票:0回答:1
wpf data-binding wpf-controls
1个回答
0
投票

正如emocht提到的,我忘记在ControlTemplate中指定TargetType:

<ControlTemplate TargetType="Button">
    <Border Background="#F6F9FC" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="4"
        CornerRadius="20" x:Name="Border" Padding="22 0">
        <ContentPresenter Content="{TemplateBinding Content}" />
    </Border>
</ControlTemplate>
© www.soinside.com 2019 - 2024. All rights reserved.