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

Jal*_*lal 6 c# wpf visual-studio

为什么我收到此错误:

'{DependencyProperty.UnsetValue}' is not a valid value for the 'System.Windows.Controls.Panel.Background' property on a Setter.
Run Code Online (Sandbox Code Playgroud)

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

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

编辑:

在Player.xaml(UserControl)中:

<Button Height="40" Name="btnNext"  Style="{StaticResource ResourceKey=NextButton}" Click="btnNext_Click" />
Run Code Online (Sandbox Code Playgroud)

在我重建项目之后,我在#: - s上面的行上看到了错误

在Constants.xaml中:

<ImageBrush x:Key="nextImage" ImageSource="../Images/next.png" />
Run Code Online (Sandbox Code Playgroud)

在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>
Run Code Online (Sandbox Code Playgroud)

提前致谢...:)

Jal*_*lal 18

嘿!

最后我解决了!我只是改变每一个StaticResourceDynamicResource,而每一件事情,现在是好的!

  • 不知道为什么,但+1,因为这也适合我. (2认同)