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

1// Define the custom button control object
2System.Windows.Controls.Button myButton = new System.Windows.Controls.Button
3{
4 Name = "myButton",
5 Content = "Buy",
6 Foreground = Brushes.White,
7 Background = Brushes.Green,
8};
9
10// Create a custom SimpleFont object and then apply it to the button
11SimpleFont myFont = new SimpleFont("Consolas", 22);
12
13myFont.ApplyTo(myButton);