This thread looks to be a little on the old side and therefore may no longer be relevant. Please see if there is a newer thread on the subject and ensure you're using the most recent build of any software if your question regards a particular product.
This thread has been locked and is no longer accepting new posts, if you have a question regarding this topic please email us at support@mindscape.co.nz
|
Hello I have some trouble setting margin and padding on my DataGrid cells. I only manage to set another margin on a cell that has a DateTime data type by changing the style of textblocks in the DataGrid. All other cells are unaffected by the changes I make. When I try to inspect the cells in WPF Inspector the whole thing crashes saying that a trigger was too complex. Surely there must be an easy way of controlling the styling/margin/padding of DataGrid cells by adding a style as a resource? If not, how can I achieve what I need? Best regards Nicklas |
|
|
Hi Nicklas, Apologies for the delayed reply. The padding is managed by the various types of editors that display the various types of data. You can see this by opening one of the *.DataGrid.xaml files in the Themes folder within the installation directory of WPF Elements. Near the top there is an "Editor styles" section that lists all the editor styles. Then after that is the "Display templates" section which has templates that display the cell values when they are not in edit mode. To adjust the padding, create your own copy of these styles and templates with the custom padding that you need. You can see how these styles and templates are applied at the end of the xaml file - by setting the BuiltInEditorStyles and BuiltInDisplayTemplates properties of the DataGrid. Let me know if you have further questions about this. -Jason Fauchelle |
|