@@ -880,6 +880,24 @@ internal void SetFocusOnViewChanged()
880880
881881 #region Private Methods
882882
883+ /// <summary>
884+ /// Finds the special date icon details for a given date using a loop to avoid delegate allocation.
885+ /// </summary>
886+ /// <param name="dateTime">The date to look up.</param>
887+ /// <returns>The matching CalendarIconDetails or null.</returns>
888+ CalendarIconDetails ? GetSpecialDateIcon ( DateTime dateTime )
889+ {
890+ for ( int i = 0 ; i < _specialDates . Count ; i ++ )
891+ {
892+ if ( CalendarViewHelper . IsSameDate ( _calendarViewInfo . View , _specialDates [ i ] . Date , dateTime , _calendarViewInfo . Identifier ) )
893+ {
894+ return _specialDates [ i ] ;
895+ }
896+ }
897+
898+ return null ;
899+ }
900+
883901 /// <summary>
884902 /// Method to find the range is present in current view or not.
885903 /// </summary>
@@ -1635,7 +1653,7 @@ void DrawMonthCells(ICanvas canvas, bool isRTL, float weekNumberWidth, float mon
16351653 // The current date is today date and not a range then need to considered the today text style.
16361654 bool isTodayDate = todayDate . Date . Equals ( dateTime . Date ) ;
16371655 //// Stores the special dates icon details for drawing.
1638- CalendarIconDetails ? calendarSpecialDayIconDetails = _specialDates . FirstOrDefault ( details => CalendarViewHelper . IsSameDate ( _calendarViewInfo . View , details . Date , dateTime , _calendarViewInfo . Identifier ) ) ;
1656+ CalendarIconDetails ? calendarSpecialDayIconDetails = GetSpecialDateIcon ( dateTime ) ;
16391657 CalendarTextStyle textStyle = GetMonthCellStyle ( dateTime , isTodayDate , isLeadingAndTrailingDates , isBlackoutDate , isDisabledDate , _calendarViewInfo . ShowOutOfRangeDates , calendarSpecialDayIconDetails != null , ref fillColor , cellBackground , trailingLeadingDateBackground , weekendsBackground , todayBackground , disabledDatesBackground , specialDatesBackground , cultureCalendar ) ;
16401658 //// If background color is not transparent then the background color for month cell is applied.
16411659 if ( fillColor != Colors . Transparent )
@@ -3080,7 +3098,7 @@ private void OnDateSemanticsNodeClicked(SemanticsNode node)
30803098
30813099 string blackOutDate = CalendarViewHelper . IsDateInDateCollection ( dateTime , _disabledDates ) ? SfCalendarResources . GetLocalizedString ( "Blackout Date" ) : string . Empty ;
30823100 string disabledDate = CalendarViewHelper . IsDisabledDate ( dateTime , _calendarViewInfo . View , _calendarViewInfo . EnablePastDates , _calendarViewInfo . MinimumDate , _calendarViewInfo . MaximumDate , _calendarViewInfo . SelectionMode , _calendarViewInfo . RangeSelectionDirection , _selectedRange , _calendarViewInfo . AllowViewNavigation , _calendarViewInfo . Identifier ) ? SfCalendarResources . GetLocalizedString ( "Disabled Date" ) : string . Empty ;
3083- CalendarIconDetails ? calendarSpecialDayIconDetails = _specialDates . FirstOrDefault ( details => CalendarViewHelper . IsSameDate ( _calendarViewInfo . View , details . Date , dateTime , _calendarViewInfo . Identifier ) ) ;
3101+ CalendarIconDetails ? calendarSpecialDayIconDetails = GetSpecialDateIcon ( dateTime ) ;
30843102 string specialDate = calendarSpecialDayIconDetails == null ? string . Empty : SfCalendarResources . GetLocalizedString ( "Special Date" ) ;
30853103 string dateType = string . IsNullOrEmpty ( specialDate ) ? ! string . IsNullOrEmpty ( blackOutDate ) ? blackOutDate : disabledDate : specialDate ;
30863104 string dateText = isGregorianCalendar ? dateTime . ToString ( "dddd, dd/MMMM/yyyy" ) + dateType : dateTime . ToString ( "dddd, dd/MMMM/yyyy" , cultureInfo ) + dateType ;
0 commit comments