Sumit Kumawat

Sumit Kumawat

  • NA
  • 454
  • 405.6k

how to define static resource for background color of wpf?

Feb 18 2016 1:55 AM
hi all,
im writing LinearGradientBrush code in window.resource like below
<Window.Resources>
<LinearGradientBrush x:Key="cbColor">
<GradientStop Offset="0" Color="Red"></GradientStop>
<GradientStop Offset="0.5" Color="Silver"></GradientStop>
<GradientStop Offset="1" Color="Green"></GradientStop>
</LinearGradientBrush>
</Window.Resources>
and using this as a background of window as a static resource but it is giving some error.
and if am using it as a dynamic resource it working fine,im confused why it is not working with static resource as i am writing it only in window xaml code

Answers (2)