Hello,
How would do I make the selected date have the same style as if I'm pointing the mouse on a date. i.e Blue Filled square ? Theme= IgTheme (infragistics)
How to apply the metro theme to the Calendar ?
Thank you
I found this page and it was sufficient to answer the second part of my question.
http://help.infragistics.com/Help/Doc/WPF/2015.1/CLR4.0/html/themeManager_Applying_Theme_to_Control.html
Hello User101,
I am glad you were able to find out how to apply the MetroDark theme to the XamCalendar control.
Regarding making the selected date have the same style as if you were pointing the mouse at the date as in the IgTheme, I would recommend using the ResourceProvider property of the XamCalendar to do this. This property will allow you to define a CalendarResourceProvider and set its ResourceSet property to a CalendarResourceSet.<themeName> for the theme that you wish to base off of.
The CalendarResourceProvider has a ResourceOverrides property, which you can then assign a new ResourceDictionary to and add new entries to. By overriding certain CalendarResourceId values with your own values, you can then override the selected colors for the calendar items. It appears that the main ones that you would want to override in this case would be the CalendarResourceId.SelectedFocusedItemBackgroundBrush and the CalendarResourceId.SelectedFocusedItemForegroundBrush in this case.
I have attached a sample project to demonstrate the above. I hope this helps you.
Please let me know if you have any other questions or concerns on this matter.
Sincerely,AndrewAssociate Developer
Hello Andrew,
Thank you for the sample.
I'm avoiding code behind. Is there a way to establish it in a style ?
You can establish this in a Style, and you can also establish it in XAML using the ResourceProvider that I had mentioned previously. In order to use the ResourceProvider in XAML, you will need to essentially set the CalendarResourceProvider.ResourceOverrides to a new ResourceDictionary. Inside of this ResourceDictionary, you can add items with an x:Key that matches the CalendarResourceId shown in the code-behind of the sample I had given you. For example, if you wanted to replace the CalendarResourceId.SelectedFocusedItemBackgroundBrush with your own brush, you could define a Brush in this ResourceDictionary with a key of "SelectedFocusedItemBackgroundBrush."
Doing this via a Style would potentially require quite a bit more XAML, as the backgrounds of the CalendarDay items are determined by a few Borders that exist as part of its template. These Borders' brushes are bound to a read-only, internally manipulated "Computed" brush set, but you could add a Trigger to the ControlTemplate.Triggers collection for the IsSelected property to change the Background and Foreground of the Borders and TextBlock for each calendar item. In order to do this, I would recommend first navigating to the generic.shared.xaml file commonly found at the following directory: C:\Program Files (x86)\Infragistics\<your version here>\WPF\DefaultStyles\XamCalendar.
Once you have located that directory, inside you will find a ControlTemplate with a key of "CalendarItemInner" and a Style with the key "CalendarItemBase." I would recommend that you include these two elements and their dependencies from this default style file. Doing this will allow you to write your Trigger in the ControlTemplate.Triggers collection of the "CalendarItemInner" template, and then write an implicit Style for CalendarDay that bases off of the "CalendarItemBase" style.
I have attached a sample project that demonstrates both approaches. I hope this helps you.