Visual Studio WPF设计器的问题! :(

时间:2011-02-14 21:49:36

标签: c# wpf visual-studio

为什么我收到此错误:

'{DependencyProperty.UnsetValue}' is not a valid value for the 'System.Windows.Controls.Panel.Background' property on a Setter.

我确定所有控件样式,设置得很好,但Visual Studio Designer会显示此错误! :'(我确定代码没问题,我不想用很多代码填充你的浏览器屏幕......

我多次看到这个错误,我不知道如何调试它!请帮助我,如果你有一些调试技巧!

编辑:

在Player.xaml(UserControl)中

<Button Height="40" Name="btnNext"  Style="{StaticResource ResourceKey=NextButton}" Click="btnNext_Click" />

在重建项目之后,我在#: - s

上面的行上看到了错误

在Constants.xaml中:

<ImageBrush x:Key="nextImage" ImageSource="../Images/next.png" />
Generic.xaml中的

 <Style TargetType="{x:Type Button}" x:Key="NextButton">
        <Setter Property="Background" Value="{StaticResource ResourceKey=nextImage}" />
        <Setter Property="Template" Value="{StaticResource ResourceKey=PlayerButtonTemplate}" />
    </Style>

提前致谢...:)

2 个答案:

答案 0 :(得分:18)

嘿!

最后我解决了!我只是将每个StaticResource更改为DynamicResource,现在一切都很好!

答案 1 :(得分:2)

StaticResource更改为DynamicResource,但不将其更改为基本控件。

相关问题