I am displaying a 2-level data on xamDataGrid and record selector has been replaced with checkbox. anyway to increase the indent of child level.
Alex,
Actually I meant (0,0,20,0) not (0,20,0,0). Sorry about confusing.
About your way (decrease the first column of child row) which point can I do this? I mean in XMAL or code-behide? If Code-behide any event-handler you suggest?
Many Thanks
Hello,
I am not sure that will do the trick. The margins are respectively (left, top, right, bottom) and this way you will set the top margin of the parent record. Another way to do this is to rezise the first column. Here is what I mean:
In the beginning, all of the records (parent and child) are lined up. Then you push the child record to the right with, let's say 20. So, if you resize the first cell ( take out 20 of its ActualWidth) the rest of the fields will line up again. Will this work in your scenario?
Alex.
Thanks for your suggestion. It works like charm:)
For my second question how about give different margins to parent and child checkboxes? I mean change margin of parent row to (0,20,0,0) and change margin of child row to (20,0,0,0). I guess this way can visually archive my goal. Is it possible?
Thanks
Hi,
I am going to propose a better solution to your first question. It is better to place that setter in a trigger and set the margin only to the records that are child, not the parent ( as the whole grid looks like is moved to the right ) so the style should look like this:
<Style TargetType="{x:Type igDP:DataRecordPresenter}" BasedOn="{x:Null}">
<Style.Triggers>
<Trigger Property="HasChildData" Value="False">
<Setter Property="Margin" Value="80,0,0,0"/>
</Trigger>
</Style.Triggers>
</Style>
About your next question, It would not be an easy task to do this especially if the user can move the fields and resize them. If you have defined the FieldLayouts in the xaml, you can adjust their width so that the columns line up. If the fields can be moved and resized, accomplishing this task would require more manual code.
My boss keeps asking more.....I followed your suggestion and xmldatagrid looks like below. Now he doesn't like the increased indent push right the whole row. In other words we wanna all columns of child row,except the first column (TMS trade id), should be aligned with the ones of parent row. Is there a way to archive this?