MaterialDesignInXamlToolkit icon indicating copy to clipboard operation
MaterialDesignInXamlToolkit copied to clipboard

Added BorderThickness attached DP for outlined date/time pickers

Open nicolaihenriksen opened this issue 3 years ago • 0 comments

Fix for #2737

This PR introduces 2 new assists types (DatePickerAssist and TimePickerAssist) which both contain attached DPs which can be used to set the inactive and active BorderThickness on the DatePicker/TimePicker using the outlined styles (MaterialDesignOutlinedDatePicker/MaterialDesignOutlinedTimePicker). "Inactive" is when there is no mouse/keyboard interaction with the element, and "Active" is when the element is either hovered or has keyboard focus.

For the TimePicker, I could have just added the new attached DPs directly as normal DPs on the TimePicker type, but since the properties only apply for the outlined style, I thought it was better to keep them in a TimePickerAssist type.

I updated the demo app to include some samples of this because using Thickness values that vary from the default values may require the caller to also set the HintAssist.FloatingOffset in order for the hint to be correctly placed.

The IMultiValueConverter that I added is needed to calculate a "margin diff" which ensures the UI does not "jump" between the inactive/active states. This was previously hardcoded to -1 because the of the defaults being inactive=1 and active=2.

NOTE: In the UI tests I have left a TODO because I would have liked to be able to mark a ValidationError on the contained TextBox without too much overhead. Perhaps this is something that could be added as a feature in XAMLTest? For now, the tests include an actual ValidationRule and the value is changed during the test to force the validation error.

nicolaihenriksen avatar Aug 05 '22 17:08 nicolaihenriksen