I have been trying to figure out if it is possible to add a border around all of the child rows like in the screen shot I mocked up below.
I tried to modify the DataRecordPresenter, but it just defines a single row. I then tried to modify the HeaderPresenter, but that's only for the header row. Any suggestions on how I could accomplish this would be great!!
Hello Sergey,
Thank you for your feedback. I am glad that you resolved your issue and I believe that other community members may benefit from this as well. Also I can say that the Trigger points to a particular element from the Template and it is set to the ControlTemplate, so you will still have to copy the whole Template along with its Triggers.
Hi Stefan,
Thank you, this solution works, I managed to incorporate it into my grids.
One question - for new LabelPresenter style, is it possible to use 'BasedOn' default style rather than copy the whole thing ?
Sergey
I have modified the sample I have attached before, so now it has the functionality you want. Basically I copied the default Style of the LabelPresenter and added a Trigger for one of its Borders. I also handled the FieldLayoutInitialized event of the XamDataGrid in order to set the Tags of the Fields in order to be able to determine which Field is the first, last and between.
Hope this helps you.
I have another question regarding border around child grid - your style sets border around records, is it possible to put border around header labels as well ?
This code doesn't work:
<Style TargetType="{x:Type dP:HeaderLabelArea}" x:Key="HeaderLabelStyle">
<Setter Property="BorderThickness" Value="2,2,3,0"></Setter>
<Setter Property="BorderBrush" Value="DarkRed"/>
</Style>
<dataPresenter:FieldLayout.Settings>
<dataPresenter:FieldLayoutSettings DataRecordCellAreaStyle="{StaticResource ChildRecordStyle}"
HeaderLabelAreaStyle="{StaticResource HeaderLabelStyle}"/>
</dataPresenter:FieldLayout.Settings>
Nope, this does not quite help me actually.
Is there a different method of changing the border of the last row?