You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
XAML Hot Reload not working for Brush type property in custom controls #19075
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
Run the attached sample
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.
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.
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.
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.
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.
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.
Activity
drasticactions commentedon Nov 28, 2023
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
Invalidateon 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.@etvorun What do you think?
mattleibow commentedon Nov 28, 2023
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?
drasticactions commentedon Nov 29, 2023
@mattleibow If I set the value directly on the object
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.
dotnet-policy-service commentedon Aug 13, 2026
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.
dotnet-policy-service commentedon Aug 13, 2026
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.
kubaflo commentedon Oct 16, 2026
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.