New to Telerik UI for .NET MAUI? Start a free 30-day trial

.NET MAUI Chat DatePicker

The RadChatPicker control provides a DatePickerContext that you can use to display a calendar and allow the user to choose a date.

DatePickerContext exposes the following properties that allow you to show 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;

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),
    SelectedDate = 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 });
        }
    }
};

Chat with DatePicker

.NET MAUI Chat Message

See Also

In this article