DatePicker
RadChatPicker control provides DatePickerContext that can be used to display a Calendar to choose a date.
DatePickerContext exposes the following properties you could use to provide a list of possible options to the user:
- SelectedDate - defines the currently selected date;
- MinDate - defines the min date that can be displayed and selected;
- MaxDate - defines the max date that can be displayed and selected;
- DisplayDate - defines a date in the current view;
Here is a quick example on how to user DatePicker:
DatePickerContext context = new DatePickerContext {
MinDate = new DateTime(2019, 1, 1),
MaxDate = new DateTime(2019, 2, 2),
DisplayDate = new DateTime(2019, 1, 16)};
PickerItem pickerItem = new PickerItem { Context = context };
chat.Items.Add(new TextMessage { Text = "Select a date", Author = chat.Author });
chat.Items.Add(pickerItem);
context.PropertyChanged += (s, e) =>
{
if (e.PropertyName == "SelectedDate")
{
if (context.SelectedDate != null)
{
chat.Items.Remove(pickerItem);
chat.Items.Add(new TextMessage { Author = chat.Author, Text = "" + context.SelectedDate });
}
}
};