How to customize the fontcolor of CalendarDayOfWeek in XamMonthCalendar?
At CalendarDayOfWeek,if I need the “su” of sunday to be dispalyed with red color and
"sa" of saturday to be dispalyed with blue color.
How to do it?
Hello,
Thank you for your feedback. I am glad that you resolved your issue and I believe that other community members may benefit from this as well.
Thanks again.
Thank you very much.
The convertor works.
But in the convertor the code [ value.ToString() == "Sa" ], if the culture is not en-us there will be a problem.
I change the code
Foreground="{Binding RelativeSource={RelativeSource Self},path=Text,Converter={StaticResource con}}"
into
Foreground="{Binding RelativeSource={RelativeSource Self},Converter={StaticResource con}}"
and
change the convertor as following
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
var ele = value as TextBlock;
if (ele != null)
if (ele.DataContext.ToString() == "Saturday")
return Brushes.Blue;
}
if (ele.DataContext.ToString() == "Sunday")
return Brushes.Red;
return Binding.DoNothing;
That‘s works in all culture ^_^
Thank you very much. your sample code save me a lot of time
Thank you for your post. I have been looking into it and I created a sample project for you with the functionality you want. Basically I copied the default Style of the CalendarDayOfWeek and added a Converter for the Foreground of the TextBlock in its Template. Please let me know if this helps you or you need further assistance on this matter.
Looking forward for your reply.