Share via


AdornerFonts Class

Provides a set of common brushes that can be used on adorners.

Inheritance Hierarchy

System.Object
  Microsoft.Windows.Design.Interaction.AdornerFonts

Namespace:  Microsoft.Windows.Design.Interaction
Assembly:  Microsoft.Windows.Design.Interaction (in Microsoft.Windows.Design.Interaction.dll)

Syntax

'Declaration
Public NotInheritable Class AdornerFonts
public static class AdornerFonts
public ref class AdornerFonts abstract sealed
[<AbstractClass>]
[<Sealed>]
type AdornerFonts =  class end
public final class AdornerFonts

The AdornerFonts type exposes the following members.

Properties

  Name Description
Public propertyStatic member FontFamily Gets a FontFamily for the current item.
Public propertyStatic member FontFamilyKey Gets a resource key for the FontFamily for the adorner.
Public propertyStatic member FontSize Gets the font size to paint the current FontFamily.
Public propertyStatic member FontSizeKey Gets a resource key for the font size for the adorner.

Top

Remarks

Use the AdornerFonts class to standardize the appearance of your custom adorner controls. By using this pre-defined font family and size, your custom adorners participate in the color scheme of the WPF Designer.

Examples

The following code example shows how to use the AdornerFonts class to set the font family and size of a CheckBox control. For more information, see Walkthrough: Debugging WPF Custom Controls at Design Time.

' The constructor sets up the adorner control. 
Public Sub New()
    autoSizeCheckBox = New CheckBox()
    autoSizeCheckBox.Content = "AutoSize"
    autoSizeCheckBox.IsChecked = True
    autoSizeCheckBox.FontFamily = AdornerFonts.FontFamily
    autoSizeCheckBox.FontSize = AdornerFonts.FontSize
    autoSizeCheckBox.Background = CType( _
        AdornerResources.FindResource(AdornerColors.RailFillBrushKey),  _
        Brush)
End Sub
// The constructor sets up the adorner control. 
public AutoSizeAdornerProvider()
{
    autoSizeCheckBox = new CheckBox();
    autoSizeCheckBox.Content = "AutoSize";
    autoSizeCheckBox.IsChecked = true;
    autoSizeCheckBox.FontFamily = AdornerFonts.FontFamily;
    autoSizeCheckBox.FontSize = AdornerFonts.FontSize;
    autoSizeCheckBox.Background = AdornerResources.FindResource(
        AdornerColors.RailFillBrushKey) as Brush;
}

Thread Safety

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

See Also

Reference

Microsoft.Windows.Design.Interaction Namespace

AdornerPanel

AdornerColors

AdornerResources

PrimarySelectionAdornerProvider

Other Resources

Walkthrough: Creating a Design-time Adorner

Walkthrough: Implementing a Rail Inside a Control

Walkthrough: Debugging WPF Custom Controls at Design Time

Adorner Architecture