ApplyTo()

View as Markdown

Definition

Applies a custom SimpleFont object’s properties (family, size, and style) to a Windows Control.

Method Return Value

This method does not return a value.

Syntax

\<simplefont\>.ApplyTo(DependencyObject target)

Parameters

ParameterDescription
targetThe DependencyObject to apply the SimpleFont object

Examples

// Define the custom button control object
System.Windows.Controls.Button myButton = new System.Windows.Controls.Button
{
Name = "myButton",
Content = "Buy",
Foreground = Brushes.White,
Background = Brushes.Green,
};
// Create a custom SimpleFont object and then apply it to the button
SimpleFont myFont = new SimpleFont("Consolas", 22);
myFont.ApplyTo(myButton);