This topic has not yet been rated - Rate this topic

FrameworkContentElement.DefaultStyleKey Property

Gets or sets the key to use to find the style template for this control in themes. This is a dependency property.

Namespace: System.Windows
Assembly: PresentationFramework (in presentationframework.dll)
XML Namespace:  http://schemas.microsoft.com/winfx/2006/xaml/presentation

protected internal Object DefaultStyleKey { get; set; }
/** @property */
protected Object get_DefaultStyleKey ()

/** @property */
protected void set_DefaultStyleKey (Object value)

protected internal function get DefaultStyleKey () : Object

protected internal function set DefaultStyleKey (value : Object)

You cannot use this property in XAML.

Property Value

The style key. To work correctly as part of theme style lookup, this value is expected to be the Type of the element being styled. a null reference (Nothing in Visual Basic) is an accepted value for a certain case; see Remarks.

Identifier field

DefaultStyleKeyProperty

Metadata properties set to true

AffectsMeasure

This property is typically not set through any of its direct setters. Instead, you override the type-specific metadata of this dependency property every time you create a new subclass. When you subclass, call the OverrideMetadata method against the DefaultStyleKeyProperty identifier, within the static constructor of the control subclass.

For instance, an inline class such as Bold actually has very little implementation beyond overriding the DefaultStyleKey metadata in its static constructor, and exposing several instance constructors. The fact that elements surrounded by the Bold tag gain a FontWeight property of Bold is implemented within the theme style that was referenced by setting the default value of DefaultStyleKey to typeof(Bold).

If you want your element or control to deliberately not use theme styles, set the OverridesDefaultStyle property to true.

Windows 98, Windows Server 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

.NET Framework

Supported in: 3.0
Did you find this helpful?
(1500 characters remaining)

Community Additions

ADD
© 2013 Microsoft. All rights reserved.