Skip to content

XAML Hot Reload not working for Brush type property in custom controls #19075

Open

Description

Description

I've developed a custom control that renders an elliptical view with a property named ContainerBackground of type Brush. However, when I attempt to update the color value through hot reload, the change isn't reflected in the UI.

HotReloadIssueMAUI.mp4

Steps to Reproduce

  1. Run the attached sample
  2. Modify the color value and initiate a hot reload. Observe that the OnPropertyChanged event isn't triggered, and the UI doesn't display the new color.

Additional information: If I use hot reload to alter a different property, the color value is successfully updated alongside that property. Furthermore, directly supplying the color value instead of using a SolidColorBrush also results in the color change being effective.

Link to public reproduction project repository

https://github.com/anandhan-rajagopal/CustomControlSample

Version with bug

8.0.3

Is this a regression from previous behavior?

Not sure, did not test other versions

Last version that worked well

Unknown/Other

Affected platforms

Android, Windows, I was not able test on other platforms

Affected platform versions

Android 5.0 and above

Did you find any workaround?

NA

Relevant log output

NA

Activity

  1. ghost added
    t/bug
    on Nov 28, 2023
  2. drasticactions commented on Nov 28, 2023

    @drasticactions
    Contributor

    I have updated your example: https://github.com/drasticactions/MauiRepros/tree/main/CustomDrawing

    So far, I don't think this is an XAML Hot Reload issue. I updated your example to have a button that will show the current ContainerBackground color for the object. If you change it with XAML Hot Reload, and then click the "Show Color" button, you'll see the updated value, but the color itself hasn't changed for your shape until you force the invalidation to happen by moving the window.

    That seems like the root issue is an MAUI one, where it isn't calling Invalidate on the underlying graphics control when updated this way. In the XAML Hot Reload code we could probably force this to invalidate but it may be worth finding the root issue in MAUI that's causing it, if that is the case.

    スクリーンショット 2023-11-28 22 30 29 スクリーンショット 2023-11-28 22 30 39

    @etvorun What do you think?

  3. added
    partner/hot-reload-xaml
    on Nov 28, 2023
  4. added
    area-tooling
    on Nov 28, 2023
  5. mattleibow commented on Nov 28, 2023

    @mattleibow
    Member

    We need to fix this in maui.

    The issue may be that setting the Color property does not get propagated to the view. Like the ImageSource. Does setting a new brush entirely work?

  6. added
    area-drawing
    and removed
    area-tooling
    partner/hot-reload-xaml
    on Nov 28, 2023
  7. added this to the Backlog milestone on Nov 28, 2023
  8. drasticactions commented on Nov 29, 2023

    @drasticactions
    Contributor

    We need to fix this in maui.

    The issue may be that setting the Color property does not get propagated to the view. Like the ImageSource. Does setting a new brush entirely work?

    @mattleibow If I set the value directly on the object

    <local:DrawingBox x:Name="BoxDrawing" ContainerBackground="Green" Grid.Row="0">
     </local:DrawingBox>

    Then the value propagates, the view is invalidated, and it redraws. Else, the value is updated, but the view is not invalidated. I would need to validate the XAML Hot Reload codebase to see if we're special casing the other case to force it to invalidate or not. But in both cases, the value is updated on the object, so AFAIK XAML Hot Reload is at least setting the value correctly.

  9. added
    partner/hot-reload-xaml
    on Nov 29, 2023
  10. added
    partner/hot-reload-xaml-full-page-fixed
    on Jun 5, 2024
  11. added
    s/try-latest-version
    on Aug 13, 2026
  12. dotnet-policy-service commented on Aug 13, 2026

    @dotnet-policy-service
    Contributor

    Hi @@ghost. We have added the "s/try-latest-version" label to this issue, which indicates that we'd like you to try and reproduce this issue on the latest available public version. This can happen because we think that this issue was fixed in a version that has just been released, or the information provided by you indicates that you might be working with an older version.

    You can install the latest version by installing the latest Visual Studio (Preview) with the .NET MAUI workload installed. If the issue still persists, please let us know with any additional details and ideally a reproduction project provided through a GitHub repository.

    This issue will be closed automatically in 7 days if we do not hear back from you by then - please feel free to re-open it if you come back to this issue after that time.

  13. dotnet-policy-service commented on Aug 13, 2026

    @dotnet-policy-service
    Contributor

    Hi @ghost. We have added the "s/try-latest-version" label to this issue, which indicates that we'd like you to try and reproduce this issue on the latest available public version. This can happen because we think that this issue was fixed in a version that has just been released, or the information provided by you indicates that you might be working with an older version.

    You can install the latest version by installing the latest Visual Studio (Preview) with the .NET MAUI workload installed. If the issue still persists, please let us know with any additional details and ideally a reproduction project provided through a GitHub repository.

    This issue will be closed automatically in 7 days if we do not hear back from you by then - please feel free to re-open it if you come back to this issue after that time.

  14. removed
    s/try-latest-version
    on Aug 14, 2026
  15. kubaflo commented on Oct 16, 2026

    @kubaflo
    Contributor

    Keeping this open. The investigation showed that Hot Reload updates the brush value, while the custom graphics view does not redraw until another invalidation occurs. That is a narrower unresolved brush-change propagation/invalidation problem, not evidence that Hot Reload failed to assign the value. Resolution should compare mutating SolidColorBrush.Color with replacing the entire Brush and verify that both redraw without resizing the window or changing an unrelated property.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area-drawingpartner/hot-reload-xamlpartner/hot-reload-xaml-full-page-fixedplatform/androidplatform/windowst/bug

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions