Skip to content

Commit 8a8570f

Browse files
Clarify that there is no XAML markup extension for .resw string resources
Adds a note to the "Refer to a string resource identifier from XAML" section explaining that there is no markup extension (like {StaticResource}) for directly assigning .resw string resources to XAML properties. Directs developers to use x:Uid for the XAML approach, or ResourceLoader.GetString() in code. Addresses #4724 Co-authored-by: Copilot <[email protected]>
1 parent 92108f8 commit 8a8570f

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

uwp/app-resources/localize-strings-ui-manifest.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,9 @@ Instead of setting **Width** from a Resources File, you'll probably want to allo
7070
Greeting.[using:Windows.UI.Xaml.Automation]AutomationProperties.Name
7171
```
7272

73+
> [!NOTE]
74+
> Unlike XAML resource references such as `{StaticResource}` or `{ThemeResource}`, there is no XAML markup extension for directly assigning a `.resw` string resource to a property in markup—for example, `<TextBlock Text="{ms-resource:Farewell}"/>` is not valid syntax. **x:Uid** is the XAML-only approach. To explicitly set a localized string to a specific property, add the corresponding property identifier to your `.resw` file (for example, `Farewell.Text`) and set `x:Uid="Farewell"` on the element. If you need to assign a resource string to a property in code (for example, when the identifier naming convention that **x:Uid** requires doesn't fit your scenario), use `ResourceLoader.GetString()` as described in [Refer to a string resource identifier from code](#refer-to-a-string-resource-identifier-from-code).
75+
7376
## Refer to a string resource identifier from code
7477

7578
You can explicitly load a string resource based on a simple string resource identifier.

0 commit comments

Comments
 (0)