Hi,
I am looking for some help to reduce the default height and width of a cell provided by Metro Theme for a XAMDataGrid. The default height and Width of a cell in Office2010 theme is what we would like to have.
We have upgraded from Infragistics 11.1 to 13.2. The number of screens is way too many to be manually applying a override for each grid.
Is there a way we could edit the theme XAML and have this functionality applied to all Grids?
Thank you in advance
Regards
Aniket Shetty.
Hi Aniket,
Let me know if you have any further questions on this.
Did you set the XamDataGrid.FieldSettings.CellHeight property? Also, please note that since the Metro theme was designed with touch in mind, there are many places where the height is set so it's possible you missed one. Not only do you need to be aware of the MinHeight property but also the Height property. Some styles explicitly set the Height on the control to 30.
Something else you should be aware of is that the text inside the cell may be interfering. You may want to modify the cell editor's font size. Also the Padding on the CellValuePresenter.
Thank you Rob. We appreciate your response to the thread.
We tried the approach you recommended, we removed the min height and width settings etc.
However there is no impact on the GUI
Any thoughts?
Thank you
Aniket Shetty
You can include the Theme XAML in your application and use it directly instead of setting the Theme property on the XamDataGrid itself. Just add the ResourceDictionaries from the DefaultStyles folder located here:
C:\Program Files (x86)\Infragistics\2013.2\WPF\DefaultStyles\DataPresenter
You only need to add the dictionaries that belong to the style you want to use. You will also need to include their dependencies. For example, the normal Metro theme requires the following dictionaries:
DataPresenterGeneric.xaml
DataPresenterGeneric_Brushes.xaml
DataPresenterGeneric_Express.xaml
DataPresenterMetro.xaml
DataPresenterMetro_Brushes.xaml
DataPresenterMetro_Express.xaml
In your App.xaml, you can add the DataPresenterMetro.xaml ResourceDictionary so it applies to all XamDataGrids in the application.
<Application.Resources> <ResourceDictionary> <ResourceDictionary.MergedDictionaries> <ResourceDictionary Source="Themes\DataPresenterMetro.xaml"/> </ResourceDictionary.MergedDictionaries> </ResourceDictionary> </Application.Resources>
From this point on you can modify the theme xaml as you like.