0

I have requirement for nullable datepicker for xamarin maui. I can find the solutions for Xamarin Forms but is there any solution available for Xamarin MAUI.

I have tried it but with no success : https://gist.github.com/jrgcubano/4fdd6ec776c6ddeacb4d518b0355dd77

Manish Pansiniya
  • 537
  • 4
  • 14
  • Can you show me what you have done so far? – FreakyAli Dec 15 '22 at 10:47
  • @FreakyAli Nothing. He is obviously asking for something ready to use. Unfortunately such behavior can be achieved with bunch of platform specific code and custom control. – H.A.H. Dec 15 '22 at 11:00
  • See the main issue here to get the Okay and Cancel events in the datepicker dialog. We do not get that in Maui somehow. We might need to use custom code to achieve that. I am just asking if somebody has done that already. – Manish Pansiniya Dec 19 '22 at 05:37
  • Is this a Xamarin.Forms or a .NET MAUI question? Please clean up the text and the tags – Julian Dec 26 '22 at 09:35
  • I thought to keep it as sometime people with interest in Xamarin forms can answer the question. – Manish Pansiniya Jan 17 '23 at 13:08
  • Hello, Alternatively, you can use the package at the address below. https://github.com/sebarslan/Maui.NullableDateTimePicker – S Arslan Aug 04 '23 at 10:31

1 Answers1

0

See the main issue here to get the Okay and Cancel events in the datepicker dialog.

The DatePicker in maui has the OK and Cancel button.

You can trigger event DateSelected once clicking button OK in the datepicker dialog.

        <DatePicker MinimumDate="01/01/2022" 
        MaximumDate="12/31/2022"
        Date="06/21/2022" 
        DateSelected="DatePicker_DateSelected"                                  
                    />

method DatePicker_DateSelected:       

private void DatePicker_DateSelected(object sender, DateChangedEventArgs e) 
      {
            System.Diagnostics.Debug.WriteLine("the selected date is: " + e.NewDate);
      }
Jessie Zhang -MSFT
  • 9,830
  • 1
  • 7
  • 19