Hi,
We need to change font size for a XamGrid (Silverlight).
This mean for all components of a grid : cells, headers, GroupByArea, GroupColumn headers, footers, etc...
As explain by other people, changing it at grid level has no effect.
We already look many posts and we can do it for cells and headers :
<ig:XamGrid.CellStyle> <Style TargetType="ig:CellControl"> <Setter Property="FontSize" Value="10" /> </Style></ig:XamGrid.CellStyle><ig:XamGrid.HeaderStyle> <Style TargetType="igPrim:HeaderCellControl"> <Setter Property="FontSize" Value="10" /> </Style> </ig:XamGrid.HeaderStyle>
But we cannot find how to do it for GroupColumn headers, GroupByArea, footers.
Is there a way to do it for these elements ?
Or better, a way to to it for all the grid at once (would be a great feature) ?
Thanks.
Alain.
Hi Duane,
Thanks for you response bu in my case the ResourceDictionary is not referenced in the App.xaml. It's download an apply at run time.
I could achieve my goal by getting the file as a ResourceDictionary and keep it in memory.
Thanks for your research.
Regards.
Hello Alain,
When applying a theme using a ResourceDictionary the xaml file is referenced within the project. For example the Office 2010 Blue Theme can be referenced and then have an option to set the FontSize after at runtime within the style properties of the control.
I have attached a sample.
I could achieve my goal thanks to your code.
I have another question now, I would like to put the style in a ResourceDictionary and this file would be on a different server.
Do you have in Silverlight a ThemeManager that could apply a theme and keep its value (the Theme silverlight class doesn't do it). With this I could change the FontSize of the XamGrid.
In the last sample attached to get the custom style under MajTaillePoliceXamgrid method in XamGridPerso class needs to return from the Resources collection instead of just creating a new instance of the style. When clicking on the buttons to increment/decrement the font size, the styles are sealed. To resolve this issue you can create a clone instance of the styles.
I have attached an updated sample on retaining the HeaderCellControl and CellControl types.
I think I'm not well expressed, I would like to apply my own style and keep the dynamic change of the fontsize. Unfortunetly the solution to apply the new value of the fontsize erase the style of the differents control, is there a way to keep the dynamic fontsize withe a custom style.