MaterialDesignInXamlToolkit
MaterialDesignInXamlToolkit copied to clipboard
Glitch with controls inside cards
Bug explanation
It appears that there is a visual glitch whenever a certain controls are clicked on dark theme (when they're inside a card).
An example:
<Button Grid.Row="3" ToolTip="Actualiser"
Width="24" Height="24" Command="{Binding RefreshCommand}" Style="{StaticResource MaterialDesignToolForegroundButton}" >
<materialDesign:PackIcon Visibility="{Binding ElementName=DemoItemsListBox, Path=SelectedItem.AddButton}" HorizontalAlignment="Center" VerticalAlignment="Center" Kind="Refresh" Width="24" Height="24"></materialDesign:PackIcon>
</Button>
Results (when inside a card):
Results (when I put the exact same code outside of the card):
Same thing with a DataGridView when it's inside the card (it's not that apparent, but you can see the glitch on the left side of the sort arrow:
This also happens with the Light theme switched ON.
What could be the problem here? I'm suspecting its the window hosting this UserControl, but I'm not sure where to start looking. If I host these buttons on a dialog, or something, they work just fine.
Version
4.5.0
Interesting, the last time I saw this was with the ripple control inside of a tab header. I suspect it is related to that, but will need to look into it.
Looks similar to https://github.com/MaterialDesignInXAML/MaterialDesignInXamlToolkit/issues/2308
I'm still not sure what the problem is exactly, but I no longer have the glitch after uninstalling MahApps.
I wasn't using any of their components, except for the MetroWindow.
Do you have repo with this bug?
Got the same behaviour. I'm using MaterialDesignThemes Package 4.6.1
I'm currently very busy, but maybe I'm able to create a repo with the bug this week.
@Imadlekal, This might be a UI caching issue on WPF.
I had a similar problem and this is how I was able to resolve it.
Can you try adding this code after InitializeComponent()
in MainWindow.xaml.cs
Constructor and see if it resolves the issue!
/*
* TLDR: Removes random lines being drawn at grid borders.
*
* Ref: https://stackoverflow.com/questions/16177358/wpf-poor-rendering-of-application
* Try disabling GPU acceleration: RenderOptions.ProcessRenderMode = RenderMode.SoftwareOnly;
* Sometimes WPF GPU caching does a lot of tricks, and this can help, without degrading much performance IMO.
*/
RenderOptions.ProcessRenderMode = System.Windows.Interop.RenderMode.Default; // <--- Most Relevant