Diagram.Background (DynamicResource) not refreshing — old color persists, GridPattern becomes thicker until scroll

My diagram background is set using a DynamicResource. When the user switches themes, the DynamicResource updates correctly in WPF, but the GoXam diagram does not fully redraw/repaint.

  1. Old background color remains on parts of the canvas until the user scrolls or zooms.
  2. My GridPattern lines temporarily become thicker after the theme change.
    Attaching a video link. Recordings

Is there some refresh which I should do in LayoutCompleted events? Also as you see in the video , for the black color background the grid pattern lines which don’t correct on scrolling.

How do you implement your light/dark theming?

I implemented a simple SolidColorBrush resource:

    <SolidColorBrush x:Key="BackBrush" Color="WhiteSmoke" />

I used that brush as a DynamicResource for a Grid that holds my Diagram:

<Grid Background="{DynamicResource BackBrush}">
  . . .
</Grid>

Then I implemented a Button that does:

    private void Button_Click(object sender, RoutedEventArgs e) {
      var br = FindResource("BackBrush") as SolidColorBrush;
      if (br == null) return;
      if (br.Color == Colors.AntiqueWhite) {
        br.Color = Colors.LightCoral;
      } else {
        br.Color = Colors.AntiqueWhite;
      }
    }

That worked well – the effects are immediate and extend through the whole area of the diagram’s background GridPattern.