Spec: Add IsOpen Property, Events, and Commands to Control Picker
Description
Currently, the only way to open or close picker controls is by invoking platform-specific Focus or Unfocus methods. This approach is unintuitive and can lead to fragile, hard-to-maintain code.
To provide a more declarative and MVVM-friendly solution, we propose adding:
- An
IsOpen property to represent the open/closed state
Opened and Closed events for lifecycle awareness
Public API Changes
Properties
| API |
Description |
| IsOpen |
Gets or sets whether the picker dialog is open. |
IsOpen = true opens the picker.
IsOpen = false closes the picker.
- Supports two-way binding for view model integration.
Events
| API |
Description |
| Opened |
Raised when the picker dialog is opened. |
| Closed |
Raised when the picker dialog is closed. |
Usage Scenarios
XAML: Two-way Binding
<DatePicker IsOpen="{Binding IsDatePickerOpen, Mode=TwoWay}" />
Spec: Add
IsOpenProperty, Events, and Commands to Control PickerDescription
Currently, the only way to open or close picker controls is by invoking platform-specific
FocusorUnfocusmethods. This approach is unintuitive and can lead to fragile, hard-to-maintain code.To provide a more declarative and MVVM-friendly solution, we propose adding:
IsOpenproperty to represent the open/closed stateOpenedandClosedevents for lifecycle awarenessPublic API Changes
Properties
IsOpen = trueopens the picker.IsOpen = falsecloses the picker.Events
Usage Scenarios
XAML: Two-way Binding