Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix missing XamlRoot in Samples/Windowing/WindowBasicsPage.xaml.cs #298

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

colhountech
Copy link

Description

There was a problem with Samples/Windowing/cs-winui when using the TitleTextBox.Text.Contains method to find a match.

Instead of displaying the expected error dialog, an exception was thrown with the error messages:

"Value does not fall within the expected range."
"The parameter is incorrect."
"This element is already associated with a XamlRoot, it cannot be associated with a different one until it is removed from the previous XamlRoot."

To fix this issue, the solution was to assign XamlRoot to this.XamlRoot. By making this assignment, the problem was resolved, and the exception was no longer thrown.

Since you cannot paste the "\n" into the text box as it is not a multiline input, this code is unreachable and not tested.

Target Release

Please specify which release this PR should align with. e.g., 1.0, 1.1, 1.1 Preview 1.

Checklist

  • Samples build and run using the Visual Studio versions listed in the Windows development docs.
  • Samples build and run on all supported platforms (x64, x86, ARM64) and configurations (Debug, Release).
  • Samples set the minimum supported OS version to Windows 10 version 1809.
  • Samples build clean with no warnings or errors.
  • [For new samples]: Samples have completed the sample guidelines checklist and follow standardization/naming guidelines.
  • If I am onboarding a new feature, then I must have correctly setup a new CI pipeline for my feature with the correct triggers and path filters laid out in the "Onboarding Samples CI Pipeline for new feature" section in samples-guidelines.md.
  • I have commented on my PR /azp run SamplesCI-<FeatureName> to have the CI build run on my branch for each of my FeatureName my PR is modifying. This must be done on the latest commit on the PR before merging to ensure the build is up to date and accurate. Warning: the PR will not block automatically if this is not run due to '/azp run' limitation on triggering more than 10 pipelines.

…tleTextBox.Text.Contains method to find a match.

Instead of displaying the expected error dialog, an exception was thrown with the error messages:

"Value does not fall within the expected range."
"The parameter is incorrect."
"This element is already associated with a XamlRoot, it cannot be associated with a different one until it is removed from the previous XamlRoot."

To fix this issue, the solution was to assign XamlRoot to this.XamlRoot. By making this assignment, the problem was resolved, and the exception was no longer thrown.

Since you cannot paste the "\n" into the text box as it is not a multiline input, this code is unreachable and not tested.
@bpulliam
Copy link
Collaborator

/azp run

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants