Skip to content

Fixed content update issue when changing the ControlTemplate at runtime for a ContentPage #28216

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

Merged
merged 2 commits into from
Mar 17, 2025

Conversation

sheiksyedm
Copy link
Contributor

Description of Change

Implementation for dynamically updating the ControlTemplate was not added for TemplatedPage, whereas it was already supported for TemplatedView (ContentView). The support has now been added for TemplatedPage based on the TemplatedView implementation

Issues Fixed

Fixes #15649

@Copilot Copilot AI review requested due to automatic review settings March 6, 2025 11:19
@sheiksyedm sheiksyedm requested a review from a team as a code owner March 6, 2025 11:19
@dotnet-policy-service dotnet-policy-service bot added the community ✨ Community Contribution label Mar 6, 2025
Copy link
Contributor

Hey there @sheiksyedm! Thank you so much for your PR! Someone from the team will get assigned to your PR shortly and we'll get it reviewed.

@dotnet-policy-service dotnet-policy-service bot added the partner/syncfusion Issues / PR's with Syncfusion collaboration label Mar 6, 2025
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

PR Overview

This PR addresses the issue of updating a ControlTemplate at runtime for a ContentPage by adding support similar to that already implemented for TemplatedView.

  • Added automated tests in TestCases.Shared.Tests and TestCases.HostApp to validate the functionality.
  • Updated TemplatedPage.cs to trigger a content update through the handler when the template is applied.

Reviewed Changes

File Description
src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue15649.cs New automated test to verify dynamic template updates on a ContentPage.
src/Controls/tests/TestCases.HostApp/Issues/Issue15649.xaml.cs UI logic for the test case, including updating the PositionSelected property.
src/Controls/src/Core/TemplatedPage.cs Updated implementation to support dynamic ControlTemplate updates for pages.

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.

Comments suppressed due to low confidence (1)

src/Controls/tests/TestCases.HostApp/Issues/Issue15649.xaml.cs:6

  • Consider making the backing field '_positionSelected' private to better encapsulate its usage and adhere to C# naming conventions for backing fields.
public int _positionSelected = 1;

Changes added.
@jsuarezruiz jsuarezruiz added the area-controls-pages Page types label Mar 6, 2025
@jsuarezruiz
Copy link
Contributor

/azp run

Copy link

Azure Pipelines successfully started running 3 pipeline(s).

@PureWeen PureWeen added this to the .NET 9 SR6 milestone Mar 6, 2025
@PureWeen PureWeen moved this from Todo to Ready To Review in MAUI SDK Ongoing Mar 6, 2025
Copy link
Member

@mattleibow mattleibow left a comment

Choose a reason for hiding this comment

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

LGTM

@github-project-automation github-project-automation bot moved this from Ready To Review to Approved in MAUI SDK Ongoing Mar 12, 2025
@rmarinho rmarinho enabled auto-merge (squash) March 17, 2025 12:14
@rmarinho rmarinho self-assigned this Mar 17, 2025
@rmarinho rmarinho merged commit bec3377 into dotnet:main Mar 17, 2025
128 checks passed
@github-project-automation github-project-automation bot moved this from Approved to Done in MAUI SDK Ongoing Mar 17, 2025
@github-actions github-actions bot locked and limited conversation to collaborators Apr 17, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-controls-pages Page types community ✨ Community Contribution partner/syncfusion Issues / PR's with Syncfusion collaboration
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

Updating a ControlTemplate at runtime causes it to disappear.
5 participants