.NET Framework Bookmark and Share   
 index > Windows Presentation Foundation (WPF) > How to change the color of BorderBrush object?
 

How to change the color of BorderBrush object?

Hello,

I would like to change the border color and border tickness of a .NET 3.0 button under certain conditions. I don't understand how to modify the Brush object in order to do so. Oh and I don't mean it in xaml but incoding in C# like windows.xaml.cs.

Many thanks for hints

Kave

Kave

There are already brushes of all the common colors - Brushes.Red, Brushes.Yellow for instance.

Alternatively, create a new SolidColorBrush passing any Color you want. You can construct a Color with any combination of R, G and B values.

Tim Dawson
If you have a reference to the button, you can set its BorderBrush property to a new brush (Brushes.Red etc). You can also set its BorderThickness to a new instance of the Thickness class, which supports different thicknesses for the four sides.
Tim Dawson
True. I could crate a new object of this type with a different color and asign it to the old objects.property. HoweverI still dont know how to set the color for this new object. :-|
Kave

There are already brushes of all the common colors - Brushes.Red, Brushes.Yellow for instance.

Alternatively, create a new SolidColorBrush passing any Color you want. You can construct a Color with any combination of R, G and B values.

Tim Dawson
Thank you. It worked. Smile
Kave

You can use google to search for other answers

Custom Search

More Threads

• IsMouseOver won't work??
• Serialize an Image in XBAP
• Custom control can't receive focus
• Binding with RelativeSourceMode.FindAncestor causes re-layout
• Background image and buttons
• Infragistic grid
• Combining HierarchicalDataTemplate and ControlTemplate for TreeViewItem
• setting a control in a datatemplate to a property according to the value of another data item property
• Findcontrol which are added at run time
• Group ToggleButtons