mirror of
https://github.com/Stone-Red-Code/docs-desktop.git
synced 2026-09-04 09:06:04 +02:00
Merge pull request #1135 from dotnet/adegeo-links
Correct .NET Framework links that pointed to old .NET 5 URLs
This commit is contained in:
@@ -36,9 +36,9 @@ This overview concentrates on how [!INCLUDE[TLA#tla_winclient](../../../includes
|
||||
|
||||
<a name="objectaskey"></a>
|
||||
## Using Objects as Keys
|
||||
Most resource usages will set the key of the resource to be a string. However, various [!INCLUDE[TLA2#tla_winclient](../../../includes/tla2sharptla-winclient-md.md)] features deliberately do not use a string type to specify keys, instead this parameter is an object. The capability of having the resource be keyed by an object is used by the [!INCLUDE[TLA2#tla_winclient](../../../includes/tla2sharptla-winclient-md.md)] style and theming support. The styles in themes which become the default style for an otherwise non-styled control are each keyed by the <xref:System.Type> of the control that they should apply to. Being keyed by type provides a reliable lookup mechanism that works on default instances of each control type, and type can be detected by reflection and used for styling derived classes even though the derived type otherwise has no default style. You can specify a <xref:System.Type> key for a resource defined in [!INCLUDE[TLA2#tla_xaml](../../../includes/tla2sharptla-xaml-md.md)] by using the [x:Type Markup Extension](/dotnet/desktop-wpf/xaml-services/xtype-markup-extension). Similar extensions exist for other nonstring key usages that support [!INCLUDE[TLA2#tla_winclient](../../../includes/tla2sharptla-winclient-md.md)] features, such as [ComponentResourceKey Markup Extension](componentresourcekey-markup-extension.md).
|
||||
Most resource usages will set the key of the resource to be a string. However, various [!INCLUDE[TLA2#tla_winclient](../../../includes/tla2sharptla-winclient-md.md)] features deliberately do not use a string type to specify keys, instead this parameter is an object. The capability of having the resource be keyed by an object is used by the [!INCLUDE[TLA2#tla_winclient](../../../includes/tla2sharptla-winclient-md.md)] style and theming support. The styles in themes which become the default style for an otherwise non-styled control are each keyed by the <xref:System.Type> of the control that they should apply to. Being keyed by type provides a reliable lookup mechanism that works on default instances of each control type, and type can be detected by reflection and used for styling derived classes even though the derived type otherwise has no default style. You can specify a <xref:System.Type> key for a resource defined in [!INCLUDE[TLA2#tla_xaml](../../../includes/tla2sharptla-xaml-md.md)] by using the [x:Type Markup Extension](/dotnet/desktop/xaml-services/xtype-markup-extension). Similar extensions exist for other nonstring key usages that support [!INCLUDE[TLA2#tla_winclient](../../../includes/tla2sharptla-winclient-md.md)] features, such as [ComponentResourceKey Markup Extension](componentresourcekey-markup-extension.md).
|
||||
|
||||
## See also
|
||||
|
||||
- [XAML Resources](/dotnet/desktop-wpf/fundamentals/xaml-resources-define)
|
||||
- [Styling and Templating](/dotnet/desktop-wpf/fundamentals/styles-templates-overview)
|
||||
- [Styling and Templating](../controls/styles-templates-overview.md)
|
||||
|
||||
Reference in New Issue
Block a user