Avalonia icon indicating copy to clipboard operation
Avalonia copied to clipboard

DrawingImage does not update if Drawing properties change

Open TomEdwardsEnscape opened this issue 3 years ago • 0 comments

Describe the bug Changes to Avalonia properties within the DrawingImage.Drawing object do not cause that DrawingImage to be re-rendered.

To Reproduce Create a window with this XAML and click event handler:

<Button Click="ButtonClick">
    <Image Name="Drawing">
        <DrawingImage>
            <GeometryDrawing Brush="Black">
                <RectangleGeometry Rect="0,0,60,60"/>
            </GeometryDrawing>
        </DrawingImage>
    </Image>
</Button>
private void ButtonClick(object? sender, RoutedEventArgs e)
{
    var geometryDrawing = (GeometryDrawing) ((DrawingImage) Drawing.Source).Drawing;

    geometryDrawing.Brush = Brushes.Red;
}

When clicking the button, the drawing of a rectangle does not change.

Expected behavior The drawing of a rectangle should become red.

More concretely, I expect the DrawingImage.Invalidated event to be raised when any property of DrawingImage.Drawing changes, including any properties of DrawingGroup descendants that may exist within it.

Desktop (please complete the following information):

  • OS: Windows
  • Version 0.10.17

TomEdwardsEnscape avatar Aug 17 '22 12:08 TomEdwardsEnscape