简体   繁体   English

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

[英]Problem with Visual Studio WPF Designer! :(

Why i get this error: 为什么我收到此错误:

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

I'm sure that all controls styles, set well, But Visual Studio Designer display this error! 我确定所有控件样式,设置好,但Visual Studio Designer显示此错误! :'( I'm sure that code is OK, and i don't want fill your browser screen with a lots of codes... :'(我确信代码没问题,我不想用很多代码填充你的浏览器屏幕......

I saw this error many times, and i don't know how debug it! 我多次看到这个错误,我不知道如何调试它! Please help me, If u khow some debug tips! 请帮帮我,如果你有一些调试技巧!

EDITED: 编辑:

in Player.xaml(UserControl): 在Player.xaml(UserControl)中:

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

After i Rebuild the project, i saw error on the line above #:-s 在我重建项目之后,我在#: - s上面的行上看到了错误

in Constants.xaml: 在Constants.xaml中:

<ImageBrush x:Key="nextImage" ImageSource="../Images/next.png" />

in Generic.xaml: 在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>

Thanks in advance...:) 提前致谢...:)

Heh! 嘿!

Finally I solve that! 最后我解决了! I just change every StaticResource to DynamicResource , and every thing is fine now! 我只是将每个StaticResource更改为DynamicResource ,现在一切都很好!

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM