MaterialDesignInXAML / MaterialDesignInXamlToolkit

Google's Material Design in XAML & WPF, for C# & VB.Net.
http://materialdesigninxaml.net
MIT License
14.82k stars 3.4k forks source link

Fix SmartHint clipping when WindowChrome is disabled #3578

Closed nicolaihenriksen closed 1 month ago

nicolaihenriksen commented 1 month ago

Fixes #3564

The old implementation was using double.MaxValue for the height of the returned RectangleGeometry. This was causing the background to become black. I was unable to root cause why that is happening, but adjusting to a value smaller than double.MaxValue fixes the issue.

I tried to narrow down magic number at which point the black background appears, and it turned out to be 349_023 which is a very random number and therefore something I assume is just specific to my monitor/resolution/DPI setup.

So rather than using some magic number, I changed the converter to a IMultiValueConverter and I am now also passing in the ActualHeight of the (non-scaled) hint, as well as the scaling factor (HintAssist.FloatingScale). This allows me to calculate the required vertical space rather than using double.MaxValue.

The old implementation was not freezing the returned Geometry so I added that as well for the minor perf bump.

Before After
image image