Fix missing XamlRoot in Samples/Windowing/WindowBasicsPage.xaml.cs #298
+2
−1
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
/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.