Problem with Visual Studio WPF Designer! :(

Why am I getting this error:

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

I am sure that all the styles of the controls are well set, but Visual Studio Designer displays this error !: '(I am sure that the code is in order, and I do not want to have many codes on your browser screen ...

I have seen this error many times and I don’t know how to debug it! Please help me if u khow some debugging tips!

Edition:

in Player.xaml (UserControl):

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

After I rebuild the project, I saw an error on the line above #: - s

in Constants.xaml:

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

in 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...:)

+6
c # visual-studio wpf
source share
2 answers

Heh!

Finally I solve it! I just change each StaticResource to DynamicResource , and now everything is fine!

+18
source share

Change StaticResource to DynamicResource , but not to basic controls.

+2
source share

All Articles