Search code examples
wpfresourcedictionarybrush

resource dictionary null brush


I am trying to have to "skin" resource dictionaries for a wpf application that I would like to be able to switch between. I want to be able to set the background property of several user controls to a key that is a solidcolorbrush in one dictionary and null in the other.

How do I make a resource value that is null? The following doesn't seem to work.

<SolidColorBrush x:Key="ticketBodyBG">{x:Null}</SolidColorBrush>

Is there a way to do this, or should I just use a transparent brush key?


Solution

  • You can't set to null value, simply left the Brush empty, it will automatically will set to Transparent like this -

    <SolidColorBrush x:Key="ticketBodyBG"></SolidColorBrush>