Articles in this section
Category / Section

How to Open a Calendar Using Text Input Layout in .NET MAUI Calendar?

2 mins read

In this article, you will learn how to open a Syncfusion® .NET MAUI Calendar (SfCalendar) control using the .NET MAUI TextInputLayout control.

XAML
Add the TextInputLayout control with the required properties.

<inputlayout:SfTextInputLayout Hint="Select Date" x:Name="textInputLayout" ContainerType="Outlined" ShowTrailingView="True">
 <Entry x:Name="dateEntry">
   <inputlayout:SfTextInputLayout.TrailingView>
     <Label Text="đź—“"/>
   </inputlayout:SfTextInputLayout.TrailingView>
 </Entry>
</inputlayout:SfTextInputLayout>

XAML
Add the calendar with the required fields and set the IsVisible property to false to initially hide the calendar.

<calendar:SfCalendar x:Name="calendar" IsVisible="False" HeightRequest="300" View="Month" SelectionMode="Range" NavigationDirection="Forward" ShowActionButtons="True" IsShowTrailingAndLeadingDates="True" Background="White" HeaderTextColor="Purple" DayTextColor="Purple" SelectionBackground="Pink">
</calendar:SfCalendar>

C#
Show the calendar when focusing on the text input layout by handling the Focused event.

this.textInputLayout.Focused += TextInputLayout_Focused;

private void TextInputLayout_Focused(object sender, FocusEventArgs e)
{
   calendar.IsVisible = true;
}

Conclusion:
I hope you enjoyed learning how to open a calendar using the text input layout in the .NET MAUI Calendar.

You can refer to our .NET MAUI Calendar feature tour page to learn about its other groundbreaking feature representations and documentation to understand how to present and manipulate data.

For current customers, check out our components from the License and Downloads page. If you are new to Syncfusion®, try our 30-day free trial to check out our other controls.

Please let us know in the comments section if you have any queries or require clarification. You can also contact us through our support forums, Direct-Trac, or feedback portal. We are always happy to assist you!

Did you find this information helpful?
Yes
No
Help us improve this page
Please provide feedback or comments
Comments (0)
Please  to leave a comment
Access denied
Access denied