MaterialDesignInXamlToolkit icon indicating copy to clipboard operation
MaterialDesignInXamlToolkit copied to clipboard

[SmartHint] Avoid timing issue in hint position calculation

Open nicolaihenriksen opened this issue 1 year ago • 0 comments

Fixes #3695 Fixes #3698

I was not able to track down exactly why the timing issue occurs, but it is evident in the first issue mentioned above, that the same user interaction can cause different behavior which is a good indication of a timing related issue.

I tracked down the wrong calculation to this particular line of code in the converter: https://github.com/MaterialDesignInXAML/MaterialDesignInXamlToolkit/blob/eb9338c720dd93fd53aef6d6499586efa63a87ca/src/MaterialDesignThemes.Wpf/Converters/FloatingHintTranslateTransformConverter.cs#L46 The result of this calculation is essential in the placement of the hint, but not one that can easily be used as a trigger for the converter to recalculate.

The fix here, which I would like your thoughts on, is to extract said calculation into a attached property which is calculated based on a change in layout, and then use the AP in the multi-binding.

This seems to do the trick, and I can no longer reproduce the issue in the provided repo sample.

nicolaihenriksen avatar Oct 17 '24 08:10 nicolaihenriksen