I've set my column widths the way I want them:
But as you can see, xmDataGrid won't show the entire column heading (State, Vehicle, Driver#) because it has reserved nearly 20 pixels of whitespace on the right side of the column. How can I eliminate the header clipping behavior? I would also like to avoid cell clipping (which is only 4 pixels, so not as bad).
Also, I don't want the left-hand column that contains the little triangle. How do I get rid of it?
And, how can I reduce the row spacing slightly?
Hello,
Thank you for your post. I have been looking through it and I created a sample project for you with a XamDataGrid with the look you want to achieve. Basically I copied the default Style of the LabelPresenter and modify it. In the future I suggest you do so when you want to change the template of some control, but don’t want to lose functionality. Also I commented the SortIndicator control in the Style, so now when you sort a Field it won’t be visible and won’t cut the header. As for the RecordSelector there is a RecordSelectorLocation Property of the XamDataGrid’s FieldLayoutSettings which can be set to None. The default Styles are installed here: C:\Program Files (x86)\Infragistics\NetAdvantage 2011.1\WPF\DefaultStyles\DataPresenter\DataPresenterGeneric_Express.xaml by default. Please let me know if this is what you want to achieve or I misunderstood you in some way.
Looking forward for your reply.
Thanks! However, is there any way to do it without duplicating the entire template? It's not an ideal solution, as it's a bulky bunch of code to have lying around, and I presume the template overrides the theme, so that I can't switch themes.
Hello again,
I have modified my sample, so now it has the functionalities you want. I can say that I changed the Margin Property of a Grid called labelCtnr to 0 in the Template and commented the SortIndicator. When you uncommented it there weren’t any changes, because its Visibility is set to Collapsed by default and there are Triggers, which change it which I also commented. As for the large amount of code – you can move the Styles to the App.xaml file of your project and there won’t be any in your Window’s Resources. For the Records’ Height I add a Style for the DataRecordPresenter and for the Cells’ Margin I created a Style for the CellValuePresenter. Here you can see how the XamDataGrid is constructed and what are the Controls’ Names that it contains:
http://help.infragistics.com/NetAdvantage/WPF/2011.1/CLR4.0/?page=xamDataGrid_Understanding_xamDataGrid.html
Please let me know if you need further clarifications on this matter.
Thanks again. Setting the height property of DataRecordPresenter directly, as you did, has a side-effect of chopping off the bottom of the selection rectangle, so it looks strange. In the Style of CellValuePresenter, setting the Margin to 0 has no effect as far as I can see (it must be the default), but a Margin such as
<Setter Property="Margin" Value="0 -1 0 -1"/>
reduces the row height nicely. Also,
<Setter Property="Padding" Value="0 0 -3 0"/>
eliminates clipping on the right side as I desired.
I'm puzzled why this new example (in contrast to the first one) clearly has margins on the ContentPresenter "LabelContent" even if I set Margin="0" (Margin="-6 0 -6 0" actually yields zero margins on the left and right).
I re-enabled the SortIndicator with the following settings:
<igWindows:SortIndicator x:Name="SortIndicator" SortStatus="{TemplateBinding SortStatus}" Visibility="Collapsed" HorizontalAlignment="Center" VerticalAlignment="Top" Width="Auto" Grid.Column="0" Margin="0,-2,-3,0"/>
Thanks!
Thank you for your feedback. I am glad that i helped you to resolve your issue and I believe that other community members may benefit from this answer as well.
Thanks again.