mirror of
https://github.com/Stone-Red-Code/docs-desktop.git
synced 2026-09-08 16:06:07 +02:00
WPF publish initial content (#1032)
* Add overview article for new WPF (#178) * Remove previous WPF .NET 5 content * Overview article * New article: Create new WPF project (#183) * Basic index file * Finish article for new project. * acro * markdown fix * Fix build errors * fix code lang * fix code lang * Add differences article for WPF (#186) * Fix VS version for create app * Add differences article * Minor * fix overview styles code * Add code langs for overview * Port Window Overview WPF article (#1011) * Add Window overview article * Add TOC * Remove temp code * Fix headers * Port final Windows related articles (#1015) * Initial test commit * Add system dialogs * 75% complete * Add images * Fix linter * Add to toc * Add more howto * Fix code * Add get/set main window * Add missing code * Add to toc * Fix warnings * Fix warnings * missing code * Update see also * fix xref * Migrate wpf net core controls-styles articles (#1023) * Migrate control-styles * Fix links * Fix links * Port databinding article. (#1022) * Migrated databinding overview * update toc * Fix links/snippets * fix links * Move to correct folder * Port initial resources docs (#1026) * initial resources docs * Build errors * Update dotnet-desktop-guide/net/wpf/systems/xaml-resources-overview.md Co-authored-by: Genevieve Warren <[email protected]> * Apply suggestions from code review Co-authored-by: Genevieve Warren <[email protected]> * Feedback * Add app article * Add system article * Minor * meta * fix toc * Apply suggestions from code review Co-authored-by: Genevieve Warren <[email protected]> Co-authored-by: Genevieve Warren <[email protected]> * Add xaml article * reformat redirect * Redirects * WPF update XAML article (#1031) * convert snippets * minor edits * minor * Fix warnings * Fixes #1028 * Fixes #1028 * Apply suggestions from code review Co-authored-by: Genevieve Warren <[email protected]> * update redirects Co-authored-by: Genevieve Warren <[email protected]> * minor updates to link * Readd migration article * Warning fixes * Fix lint * Minor updates * Fix warnings for TOC/YML * last warnings Co-authored-by: Genevieve Warren <[email protected]>
This commit is contained in:
co-authored by
Genevieve Warren
parent
a3b012ae99
commit
ea8529f082
@@ -1,6 +1,7 @@
|
||||
---
|
||||
title: "x:Key Directive"
|
||||
ms.date: "03/30/2017"
|
||||
description: "The x:Key directive identifies elements that are created and referenced in a XAML-defined dictionary."
|
||||
f1_keywords:
|
||||
- "xKey"
|
||||
- "Key"
|
||||
@@ -37,14 +38,14 @@ Uniquely identifies elements that are created and referenced in a XAML-defined d
|
||||
|
||||
## XAML Values
|
||||
|
||||
|||
|
||||
| Value | Description |
|
||||
|-|-|
|
||||
|`stringKeyValue`|A text string to use as a key. The text string must conform to the [XamlName Grammar](xamlname-grammar.md).|
|
||||
|`markupExtensionUsage`|Within the markup extension delimiters {}, a markup extension usage that provides an object to use as a key. See Remarks.|
|
||||
|
||||
## Remarks
|
||||
|
||||
`x:Key` supports the XAML resource dictionary concept. XAML as a language doesn't define a resource dictionary implementation, that is left to specific UI frameworks. To learn more about how XAML resource dictionaries are implemented in WPF, see [XAML Resources](../net/wpf/fundamentals/xaml-resources-define.md).
|
||||
`x:Key` supports the XAML resource dictionary concept. XAML as a language doesn't define a resource dictionary implementation, that is left to specific UI frameworks. To learn more about how XAML resource dictionaries are implemented in WPF, see [Overview of XAML resources (WPF .NET)](../net/wpf/systems/xaml-resources-overview.md).
|
||||
|
||||
In XAML 2006 and WPF, `x:Key` must be provided as an attribute. You can still use nonstring keys, but this requires a markup extension usage in order to provide the nonstring value in attribute form. If you are using XAML 2009, `x:Key` can be specified as an element, to explicitly support dictionaries keyed by object types other than strings without requiring a markup extension intermediate. See the "XAML 2009" section in this topic. The remainder of the Remarks section applies specifically to the XAML 2006 implementation.
|
||||
|
||||
@@ -60,7 +61,7 @@ Uniquely identifies elements that are created and referenced in a XAML-defined d
|
||||
|
||||
- Some WPF types declare an implicit key for dictionary usage. For example, a <xref:System.Windows.Style> with a <xref:System.Windows.Style.TargetType%2A>, or a <xref:System.Windows.DataTemplate> with a <xref:System.Windows.DataTemplate.DataType%2A>, can be in a <xref:System.Windows.ResourceDictionary> and use the implicit key.
|
||||
|
||||
- WPF supports a merged resource dictionary concept. Keys can be shared between the merged dictionaries, and the shared key behavior can be accessed using <xref:System.Windows.FrameworkContentElement.FindResource%2A>. For more information, see [Merged Resource Dictionaries](../framework/wpf/advanced/merged-resource-dictionaries.md).
|
||||
- WPF supports a merged resource dictionary concept. Keys can be shared between the merged dictionaries, and the shared key behavior can be accessed using <xref:System.Windows.FrameworkContentElement.FindResource%2A>. For more information, see [Merged resource dictionaries](../net/wpf/systems/xaml-resources-merged-dictionaries.md).
|
||||
|
||||
In the overall WPF XAML implementation and application model, key uniqueness is not checked by the XAML markup compiler. Instead, missing or nonunique `x:Key` values cause load-time XAML parser errors. However, Visual Studio handling of dictionaries for WPF can often note such errors in the design phase.
|
||||
|
||||
@@ -72,7 +73,7 @@ Uniquely identifies elements that are created and referenced in a XAML-defined d
|
||||
|
||||
As stated previously, the value of a key can be supplied through a markup extension and can be other than a string value. An example WPF scenario is that the value of `x:Key` may be a [ComponentResourceKey](../framework/wpf/advanced/componentresourcekey-markup-extension.md). Certain controls expose a style key of that type for a custom style resource that influences part of the appearance and behavior of that control without totally replacing the style. An example of such a key is <xref:System.Windows.Controls.ToolBar.ButtonStyleKey%2A>.
|
||||
|
||||
The WPF merged dictionary feature introduces additional considerations for key uniqueness and key lookup behavior. For more information, see [Merged Resource Dictionaries](../framework/wpf/advanced/merged-resource-dictionaries.md).
|
||||
The WPF merged dictionary feature introduces additional considerations for key uniqueness and key lookup behavior. For more information, see [Merged resource dictionaries](../net/wpf/systems/xaml-resources-merged-dictionaries.md).
|
||||
|
||||
## XAML 2009
|
||||
|
||||
@@ -95,7 +96,7 @@ keyObject
|
||||
|
||||
### XAML Values
|
||||
|
||||
|||
|
||||
| Value | Description |
|
||||
|-|-|
|
||||
|`keyObject`|Object element for the object that is used as the key for a given `object` in a specialized dictionary.|
|
||||
|
||||
@@ -111,6 +112,6 @@ keyObject
|
||||
|
||||
## See also
|
||||
|
||||
- [XAML Resources](../net/wpf/fundamentals/xaml-resources-define.md)
|
||||
- [Resources and Code](../framework/wpf/advanced/resources-and-code.md)
|
||||
- [Overview of XAML resources (WPF .NET)](../net/wpf/systems/xaml-resources-overview.md)
|
||||
- [Resources in code (WPF .NET)](../net/wpf/systems/xaml-resources-and-code.md)
|
||||
- [StaticResource Markup Extension](../framework/wpf/advanced/staticresource-markup-extension.md)
|
||||
|
||||
Reference in New Issue
Block a user