Quantcast
Channel: Xamarin.Forms — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 77050

DatePicker DateSelected Event Not Fired if the date doesn't change?

$
0
0

So I have a form where I would like a user to add a "note" to a day. So they click a button which sets the Focus to a DatePicker:

<DatePicker x:Name="addToNoteDiaryDate" HorizontalOptions="FillAndExpand" IsVisible="False" DateSelected="addNoteToDiary_DateSelected"/>

with the event:

        private void addNoteToDiary_DateSelected(object sender, DateChangedEventArgs e)
        {
            //Add Note
        }

Now the DatePicker's current date is set to today. If the user selects "yesterday" lets say and clicks done, the event is fired and the note is added.

If the user leaves the date on today and clicks "Done" no event is fired and no note added.

I thought about using the unfocused event but I'm guessing this event fires even if the user clicks away from the datepicker control. i.e. cancelling the datepicker.

I am running on android is this behavior correct? what is the best way to get the DateSelected event?


Viewing all articles
Browse latest Browse all 77050

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>