Assembly: PresentationFramework (in presentationframework.dll)
XML Namespace: http://schemas.microsoft.com/winfx/2006/xaml/presentation
/** @property */ public Style get_Style () /** @property */ public void set_Style (Style value)
resourceExtension One of the following: StaticResource, or DynamicResource. See Resources Overview. styleResourceKey The key that identifies the style being requested. The key refers to an existing resource in a ResourceDictionary.
Property ValueThe locally applied style for the element, if present. Otherwise, a null reference (Nothing in Visual Basic). The default for a default-constructed FrameworkElement is a null reference (Nothing in Visual Basic).
For controls, the current style is often provided by an implicit style from control theming, or from styles generally applied to controls of that type by your application's resources. This property will not set or return such theme styles. It will only locally set the style, and return the style values that were locally set.
TSetting the styles has some restrictions. You can reset the entire Style property to a new Style at any time, which will force a layout recomposition. However, as soon as that style is in use by a loaded element, the Style in use should be considered sealed. Attempting to make a change to any individual property of an in-use style (such as anything within the collection of Setters) will raise an exception.
Style is a dependency property with special precedence. The locally set style operates at the highest precedence in the property system (with exception of animations, and animating a style is an advanced scenario). Therefore, if you set the Style property, that style will apply and will have higher precedence than implicit styles. See Dependency Property Value Precedence.
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 EditionThe Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.