請原諒我,作爲一個完整的新手,但我下面的教程(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片段的位置。 –