Manish Pansiniya
Manish Pansiniya

Reputation: 545

Nullable DatePicker for Xamarin MAUI

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

Upvotes: 1

Views: 1054

Answers (1)

Jessie Zhang -MSFT
Jessie Zhang -MSFT

Reputation: 13879

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);
      }

Upvotes: 1

Related Questions