Show / Hide Table of Contents

Method wpfBuilder.Brush(+ 1 overload)


Overload

Sets background and/or foreground brush (color, gradient, etc) of the last added element.

public wpfBuilder Brush(Brush background = null, Brush foreground = null)
Parameters
background  (Brush)

Background brush. See System.Windows.Media.Brushes, System.Windows.SystemColors. Descendants usually inherit this property.

foreground  (Brush)

Foreground brush. Usually sets text color. Descendants usually override this property.

Returns
wpfBuilder
Exceptions
NotSupportedException

Last added element must be Control, Panel, Border or TextBlock. With foreground only Control or TextBlock.

Examples

b.R.Add<Label>("Example1").Brush(Brushes.Cornsilk, Brushes.Green).Border(Brushes.BlueViolet, 1);
b.R.Add<Label>("Example2").Brush(new LinearGradientBrush(Colors.Chocolate, Colors.White, 0));

Overload(top)

Sets background and/or foreground color of the last added element.

public wpfBuilder Brush(ColorInt? background = null, ColorInt? foreground = null)
Parameters
background  (ColorInt?)
foreground  (ColorInt?)
Returns
wpfBuilder
Exceptions
NotSupportedException

Last added element must be Control, Panel, Border or TextBlock. With foreground only Control or TextBlock.