Skip to content

Commit 5d56d1d

Browse files
Merge pull request #3829 from syncfusion-content/993890_Autofit_support_in_calendar
993890 - Autofit support in Calendar
2 parents 4149f1e + 4e95061 commit 5d56d1d

File tree

2 files changed

+40
-0
lines changed

2 files changed

+40
-0
lines changed
427 KB
Loading

MAUI/Calendar/views.md

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,46 @@ this.calendar.MonthView = new CalendarMonthView()
124124
![Customize Week number Appearance in .NET MAUI Calendar.](images/views/net-maui-month-view-show-week-numbers-customize.png)
125125

126126

127+
### Autofit
128+
Autofit dynamically adjusts the month row height based on the number of weeks in the current month. It is available only in the `Month view` when:
129+
* [ShowTrailingAndLeadingDates](https://help.syncfusion.com/cr/maui/Syncfusion.Maui.Calendar.SfCalendar.html?tabs=tabid-6%2Ctabid-12%2Ctabid-18%2Ctabid-50%2Ctabid-10%2Ctabid-8%2Ctabid-14%2Ctabid-4%2Ctabid-22%2Ctabid-26%2Ctabid-24%2Ctabid-16%2Ctabid-2%2Ctabid-20#Syncfusion_Maui_Calendar_SfCalendar_ShowTrailingAndLeadingDates) is set to `false`, and
130+
* [Mode](https://help.syncfusion.com/cr/maui/Syncfusion.Maui.Calendar.SfCalendar.html#Syncfusion_Maui_Calendar_SfCalendar_Mode) is [Dialog](https://help.syncfusion.com/cr/maui/Syncfusion.Maui.Calendar.CalendarMode.html#Syncfusion_Maui_Calendar_CalendarMode_Dialog) or [RelativeDialog](https://help.syncfusion.com/cr/maui/Syncfusion.Maui.Calendar.CalendarMode.html#Syncfusion_Maui_Calendar_CalendarMode_RelativeDialog).
131+
132+
N>
133+
Autofit is Not applicable when
134+
* [NumberOfVisibleWeeks](https://help.syncfusion.com/cr/maui/Syncfusion.Maui.Calendar.CalendarMonthView.html?tabs=tabid-2#Syncfusion_Maui_Calendar_CalendarMonthView_NumberOfVisibleWeeks) is less than 6.
135+
* [PopupHeight](https://help.syncfusion.com/cr/maui/Syncfusion.Maui.Calendar.SfCalendar.html?tabs=tabid-6%2Ctabid-12%2Ctabid-18%2Ctabid-50%2Ctabid-10%2Ctabid-8%2Ctabid-14%2Ctabid-4%2Ctabid-22%2Ctabid-26%2Ctabid-24%2Ctabid-16%2Ctabid-2%2Ctabid-20#Syncfusion_Maui_Calendar_SfCalendar_PopupHeight) is less than or equal to 0.
136+
137+
{% tabs %}
138+
{% highlight xaml tabtitle="MainPage.xaml" %}
139+
140+
<Grid>
141+
<calendar:SfCalendar x:Name="calendar"
142+
Mode="Dialog"
143+
ShowTrailingAndLeadingDates="False"/>
144+
<Button Text="Open Calendar"
145+
x:Name="calendarButton"
146+
Clicked="Button_Clicked"
147+
HorizontalOptions="Center"
148+
VerticalOptions="Center"
149+
HeightRequest="50"
150+
WidthRequest="150">
151+
</Button>
152+
</Grid>
153+
154+
{% endhighlight %}
155+
{% highlight c# tabtitle="MainPage.xaml.cs" %}
156+
157+
private void Button_Clicked(object sender, EventArgs e)
158+
{
159+
this.calendar.IsOpen = true;
160+
}
161+
162+
{% endhighlight %}
163+
{% endtabs %}
164+
165+
![Autofit in .NET MAUI Calendar.](images/views/autofit-calendar.gif)
166+
127167
## Year view
128168
The Year view displays the current year's month. A calendar year is a one-year period that begins on January 1 and ends on December 31. By default, displays the current year's month and the current month is highlighted by a separate color that is different from the rest of the month color in the `Year view`. You can easily navigate to the desired month dates from the year view.
129169

0 commit comments

Comments
 (0)