Skip to content

Update x:Load attribute documentation#6005

Open
hoshiizumiya wants to merge 1 commit into
MicrosoftDocs:docsfrom
hoshiizumiya:patch-2
Open

Update x:Load attribute documentation#6005
hoshiizumiya wants to merge 1 commit into
MicrosoftDocs:docsfrom
hoshiizumiya:patch-2

Conversation

@hoshiizumiya

Copy link
Copy Markdown
Contributor

Clarified restrictions and usage notes for x:Load attribute, including details on x:Bind interactions and error handling.

Clarified restrictions and usage notes for x:Load attribute, including details on x:Bind interactions and error handling.
@prmerger-automator

Copy link
Copy Markdown
Contributor

@hoshiizumiya : Thanks for your contribution! The author(s) and reviewer(s) have been notified to review your proposed change.

@prmerger-automator

Copy link
Copy Markdown
Contributor

@hoshiizumiya : Thanks for your contribution! The author(s) and reviewer(s) have been notified to review your proposed change.

@learn-build-service-prod

Copy link
Copy Markdown
Contributor

Learn Build status updates of commit d693e80:

✅ Validation status: passed

File Status Preview URL Details
hub/apps/develop/platform/xaml/x-load-attribute.md ✅Succeeded

For more details, please refer to the build report.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates the x:Load attribute documentation to clarify platform-specific restrictions (notably WinUI 3 Window root scenarios) and to add guidance about x:Bind interactions and known C++/WinRT limitations.

Changes:

  • Added a CAUTION note about FindName behavior when the XAML root element is a WinUI 3 Window.
  • Expanded x:Bind guidance to mention a naming collision that can trigger XAML compiler errors.
  • Added new “Restrictions” bullets linking to known C++/WinRT issues/workarounds.

Comment on lines +21 to +22
> [!Caution]
> Regarding the 'Window' is not a DependencyObject. You can not use it in which the xaml root is the Window because the [FindName method](/windows/windows-app-sdk/api/winrt/microsoft.ui.xaml.frameworkelement.findname) needs. Check it at https://github.com/microsoft/microsoft-ui-xaml/issues/9842.
There are several different ways to load the elements:

- Use an [x:Bind](x-bind-markup-extension.md) expression to specify the load state. The expression should return **true** to load and **false** to unload the element.
- Use an [x:Bind](x-bind-markup-extension.md) expression to specify the load state. The expression should return **true** to load and **false** to unload the element. The x:Name you set and the x:Bind binding name should not be the same if you use x:Bind in the x:Load or the xaml complier will report an error.
Comment on lines +71 to +72
- In the C++/WinRT, Compile error when using x:Load and x:Bind. Check it and workaround at https://github.com/microsoft/microsoft-ui-xaml/issues/7579.
- In the C++/WinRT, FindName wont reload an object that has been UnloadObjected. Check it at https://github.com/microsoft/microsoft-ui-xaml/issues/10179.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants