请原谅我,作为一个完整的新手,但我下面的教程(Creating a Custom WPF Button Template in XAML),和我遇到了错误:住宅“模板”式“FrameworkElement的”未找到
FormatException was thrown due to document error: Property 'Template' was not found in type 'FrameworkElement'.
看来,误差在XAML下面的代码茎:
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="Button">
<Border Name="border"
BorderThickness="1"
Padding="4,2"
BorderBrush="DarkGray"
CornerRadius="3"
Background="{TemplateBinding Background}">
<Grid >
<ContentPresenter HorizontalAlignment="Center"
VerticalAlignment="Center" Name="contentShadow"
Style="{StaticResource ShadowStyle}">
<ContentPresenter.RenderTransform>
<TranslateTransform X="1.0" Y="1.0" />
</ContentPresenter.RenderTransform>
</ContentPresenter>
<ContentPresenter HorizontalAlignment="Center"
VerticalAlignment="Center" Name="content"/>
</Grid>
</Border>
我一直在到处找一个解决方案,但还没有找到一个...这使我相信,我是无论是俯视还是过度俯视。
我缺少什么?预先感谢您的任何帮助!
请参阅_Download the example XAML file_ in that link for the complete self-contained example。它显示应该插入您引用的XAML片段的位置。 –