-
Notifications
You must be signed in to change notification settings - Fork 3.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added BorderThickness attached DP for outlined date/time pickers #2805
Conversation
Tests are running green locally, so I presume it has something to do with the delay being too short
Initial mouse position was on the pickers, so I added a dummy button to initially move the mouse position away from the pickers.
Ideally I would like XAMLTest to allow me to set a ValidationError "on the fly" if possible. For now, tests are updated with a real ValidationRule and invalid values are set to provoke the validation error.
await Task.Delay(50); // Wait for the visual change | ||
var focusedBorderThickness = await datePickerTextBox.GetProperty<Thickness>(Control.BorderThicknessProperty); | ||
|
||
// TODO: It would be cool if a validation error could be set via XAMLTest without the need for the Binding and ValidationRules elements in the XAML above. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a good request. I will have to look into what that API could look like. I typically have done that by building out a custom control in the test project (as this then supports things like code behind, view models, etc). But I can certainly see a desire to not have to jump through all of those hoops.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a good request. I will have to look into what that API could look like. I typically have done that by building out a custom control in the test project (as this then supports things like code behind, view models, etc). But I can certainly see a desire to not have to jump through all of those hoops.
Cool! As mentioned in the PR, I already have a proof-of-concept PR in the XAMLTest library with one approach to adding this type of functionality. Looking forward to seeing how you would approach it.
Fix for #2737
This PR introduces 2 new assists types (
DatePickerAssist
andTimePickerAssist
) which both contain attached DPs which can be used to set the inactive and activeBorderThickness
on theDatePicker
/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 theTimePicker
type, but since the properties only apply for the outlined style, I thought it was better to keep them in aTimePickerAssist
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 theHintAssist.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 containedTextBox
without too much overhead. Perhaps this is something that could be added as a feature in XAMLTest? For now, the tests include an actualValidationRule
and the value is changed during the test to force the validation error. I added a PR with proof-of-concept for this in the XAMLTest project.