In WPF, I have rectangle like this:
<Rectangle Grid.Column="1" Name="rectangleSignal" HorizontalAlignment="Left" Width="20" Height="20" >
<Rectangle.Fill>
<StaticResource ResourceKey="image0" />
</Rectangle.Fill>
</Rectangle>
In .cs file. In some cases, I want to set this rectangle to be transparent.
I have code like this,
What should I do for Resourcekey, that I can make this rectangele be transparent?
thank you
rectangleSignal.SetResourceReference(Rectangle.FillProperty, "image0");
Edited:
I figured out myself.
Just setting peroperty to “#FFFFFFFF”
It will be fine.
Thanks everyone.
If you need to keep that reference you can add
Brushes.Transparentas a resource with that key, if you do not need to do that make an assigment to Fill. Alternatively you can also just set theVisibilityorOpacity.