11
我更改標籤的風格和下面的模板:更改標籤的風格和模板在WPF
<Label Content="Test">
<Label.Style>
<Style TargetType="{x:Type Label}">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate>
<Border BorderBrush="#DDD" BorderThickness="1" CornerRadius="2" Background="#EEE" Padding="4">
<!--<TextBlock Text="{TemplateBinding Content}" />-->
<ContentPresenter Content="{TemplateBinding Content}" />
</Border>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</Label.Style>
</Label>
在設計時
,這個工程和設計視圖顯示所有的東西好,(每個TextBlock的或ContentPresenter);但是當我運行該項目(或編譯它),收到此錯誤:
Cannot find the static member 'ContentProperty' on the type 'Control'.
任何人都可以幫助我嗎?非常感謝):