Declined
Last Updated: 29 Apr 2024 12:39 by ADMIN
Huynh
Created on: 02 Apr 2024 13:54
Category: DateTimePicker
Type: Bug Report
1
DateTimePicker: [WinUI] Accept and Cancel commands are not fired in popup mode
DateTimePicker's Accept and Cancel commands are not fired in popup mode on WinUI
1 comment
ADMIN
Didi
Posted on: 29 Apr 2024 12:39

Hello Huynh,

The team reviewed the case and actually the behavior is not an issue. This is the reason I changed the sttaus to Declined. 

The behavior happens as in the example here:

<VerticalStackLayout>
    <telerik:RadDateTimePicker x:Name="dateTimePicker"> 
        <telerik:RadDateTimePicker.PopupSettings>
            <telerik:PickerPopupSettings AcceptCommand="{Binding Accept}"
                                         AcceptCommandParameter="{Binding Date, Source={x:Reference dateTimePicker}}"
                                         CancelCommand="{Binding Cancel}"
                                         CancelCommandParameter="{Binding Date, Source={x:Reference dateTimePicker}}"/>
        </telerik:RadDateTimePicker.PopupSettings>
            <telerik:RadDateTimePicker.BindingContext>
                <local:ViewModel/>
            </telerik:RadDateTimePicker.BindingContext>
    </telerik:RadDateTimePicker>
</VerticalStackLayout>

The commands and command parameters are added to the PopupSettings. This settings are applied by default on mobile, as on mobile the default PickerMode is Popup. While on desktop the default settings are drop-down, as the default mode is DropDown.This is described here: https://docs.telerik.com/devtools/maui/controls/datetimepicker/picker-mode 

So there isn't an issue with the commands and command parameters in this case. I have updated the documentation with more details on the example in the Commands article and the changes will be live soon. 

Solution:

Set the PickerMode to Popup

<VerticalStackLayout>
    <telerik:RadDateTimePicker x:Name="dateTimePicker" PickerMode="Popup"> 
        <telerik:RadDateTimePicker.PopupSettings>
            <telerik:PickerPopupSettings AcceptCommand="{Binding Accept}"
                                         AcceptCommandParameter="{Binding Date, Source={x:Reference dateTimePicker}}"
                                         CancelCommand="{Binding Cancel}"
                                         CancelCommandParameter="{Binding Date, Source={x:Reference dateTimePicker}}"/>
        </telerik:RadDateTimePicker.PopupSettings>
            <telerik:RadDateTimePicker.BindingContext>
                <local:ViewModel/>
            </telerik:RadDateTimePicker.BindingContext>
    </telerik:RadDateTimePicker>
</VerticalStackLayout>

Hope this explains the case.

Regards,
Didi
Progress Telerik

A brand new ThemeBuilder course was just added to the Virtual Classroom. The training course was designed to help you get started with ThemeBuilder for styling Telerik and Kendo UI components for your applications. You can check it out at https://learn.telerik.com