CrossGeeks / ClearableDatePickerSample

Clearable DatePicker Sample in Xamarin Forms

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Clear button click event

nmano2188 opened this issue · comments

How to raise DateSelected event on clear button click ?

Not sure this is valid as your not selecting a date.
Just use binding and on value change decide what to do.
This way you can check when date changes to null.

Here i need to set value to date2 based on date1 value.
And also
If date1 is cleared also need to clear date2 on date1 clear event.
This is what i want and can't do this now. Any suggestions?

    var startPicker = new NullableDatePicker()
    {
        NullableDate = null,
        Format = "d MMMM"
    };
    startPicker.BindingContext = _viewModel.BirthingModel;
    startPicker.SetBinding(NullableDatePicker.NullableDateProperty, "BirthingStart");

// Birth Model bit

    private DateTime? _birthingStart;
    public DateTime? BirthingStart
    {
        get
        {
            return _birthingStart;
        }

        set
        {
           // OnProperty Change this ones Prism example
            if (SetProperty(ref _birthingStart, value))
            {
              if(value == null) SomeOtherDate = null;
            }
        }
    }

Hope this helps this is a Forms example but you should get the idea

@nmano2188
Did this fix your issue?

@SatanEnglish I will try and let you know. Thanks