Skip to content
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

DrawingBrush isn't invalidated when any nested geometry brush is changed #18229

Open
maxkatz6 opened this issue Feb 18, 2025 · 0 comments
Open

Comments

@maxkatz6
Copy link
Member

maxkatz6 commented Feb 18, 2025

Describe the bug

As per title

To Reproduce

  <DrawingBrush x:Key="CheckeredBackground"
                TileMode="Tile"
                Stretch="None"
                DestinationRect="0,0,16,16">
    <DrawingBrush.Drawing>
      <DrawingGroup>
        <GeometryDrawing Brush="{DynamicResource DarkerBrush}">
          <GeometryDrawing.Geometry>
            <RectangleGeometry Rect="0,0,16,16" />
          </GeometryDrawing.Geometry>
        </GeometryDrawing>
        <GeometryDrawing Brush="{DynamicResource LighterBrush}">
          <GeometryDrawing.Geometry>
            <RectangleGeometry Rect="0,0,8,8" />
          </GeometryDrawing.Geometry>
        </GeometryDrawing>
        <GeometryDrawing Brush="{DynamicResource LighterBrush}">
          <GeometryDrawing.Geometry>
            <RectangleGeometry Rect="8,8,8,8" />
          </GeometryDrawing.Geometry>
        </GeometryDrawing>
      </DrawingGroup>
    </DrawingBrush.Drawing>
  </DrawingBrush>

When any of DarkerBrush or LighterBrush are changed (i.e. full brush replaced, theme switched...) DrawingBrush won't reflect any of these changes when it's used as a Background on any Border.
Interestingly, any GeometryDrawing.Pen usage does work.

Workaround

Make whole DrawingBrush theme being replaced on theme switch. Can be achieved by having different DrawingBrush'es in different theme dictionaries. In which case DynamicResource can be replaced with StaticResource (as dependent brushes are static relatively to this specific theme variant).

Avalonia version

11.2.4, master

OS

No response

Additional context

Likely because geometries are not yet compositor aware resource.

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

No branches or pull requests

1 participant