Skip to content

DrawingImage does not update if Drawing properties change #8767

@TomEdwardsEnscape

Description

@TomEdwardsEnscape

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions