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.
Hello,
You can create a style for the DataRecordPresenter and set the Left Margin. If you don't set a x:key of the style, it will be applied to all of the DataRecordPresenter including the parent Records, and the there will be a margin as well. If you do set x:key, you have to apply this style to the records you choose ( child records ).
<Style TargetType="{x:Type igDP:DataRecordPresenter}" BasedOn="{x:Null}">
<Setter Property="Margin" Value="20,0,0,0"/>
</Style>
Alex.
Alex,
I tried your way but seems like it doesn't work...I attached my codes. can u pls take a look.
Thanks a lot.
<igDP:XamDataGrid Grid.Row="1" x:Name="xamDataGrid" Theme="Aero" AutoFit="False" ContextMenu="{x:Null}" SnapsToDevicePixels="True" ScrollingMode="Immediate" AllowDrop="True" RecordContainerGenerationMode="Recycle" CellContainerGenerationMode="Recycle" RecordLoadMode="LoadOnDemand" Background="Gray" DragOver="OnDragOver" Drop="OnDataDrop" PreviewMouseDown="OnXamDataGridPreviewMouseDown" PreviewMouseMove="OnXamDataGridPreviewMouseMove" PreviewMouseUp="OnXamDataGridPreviewMouseUp" MouseDoubleClick="OnGridMouseDoubleClick" MouseRightButtonDown="OnGridMouseRightButtonDown" IsGroupByAreaExpanded="False"> <igDP:XamDataGrid.Resources> <Style TargetType="{x:Type igDP:RecordSelector}"> <Setter Property="Template"> <Setter.Value> <ControlTemplate TargetType="{x:Type igDP:RecordSelector}"> <CheckBox HorizontalAlignment="Center" VerticalAlignment="Center" IsChecked="{Binding Path=DataItem.IsChecked}" Checked="OnChecked" Unchecked="OnUnChecked" > </CheckBox> </ControlTemplate> </Setter.Value> </Setter> </Style> <Style TargetType="{x:Type igDP:DataRecordPresenter}"> <Setter Property="Margin" Value="80,0,0,0"/> </Style> </igDP:XamDataGrid.Resources> <igDP:XamDataGrid.FieldLayoutSettings> <igDP:FieldLayoutSettings DataRecordSizingMode="SizedToContentAndIndividuallySizable" AutoGenerateFields="True" RecordSelectorLocation="LeftOfCellArea" ResizingMode="Default" SelectionTypeRecord="Extended" SelectionTypeField="Extended" DataRecordPresenterStyle="{StaticResource headerStyle}" DataRecordCellAreaStyle="{StaticResource rowStyle}" SelectionTypeCell="Extended"/> </igDP:XamDataGrid.FieldLayoutSettings> <igDP:XamDataGrid.FieldSettings> <igDP:FieldSettings AllowEdit="False" CellClickAction="SelectRecord" CellMinWidth="0" AllowCellVirtualization="true" CellValuePresenterStyle="{StaticResource cellStyle}" LabelPresenterStyle="{StaticResource columnStyle}"/> <!--CellValuePresenterStyle="{StaticResource cellStyle}"--> </igDP:XamDataGrid.FieldSettings> </igDP:XamDataGrid>
That is because you have two styles for the DataRecordPresenter. WPF supports only one local style. You have to merge the following into one single style:
DataRecordPresenterStyle="{StaticResource headerStyle}" and
<Style TargetType="{x:Type igDP:DataRecordPresenter}"> <Setter Property="Margin" Value="80,0,0,0"/> </Style>
You saved my life again :)
tried both but still no luck.....I ended up change margin of recordselector in code.
Try changing both like CellWidht and LabelWidth
Note: make sure you have defined the fields and CellWidth and LabelWidth in the xaml, otherwise these numbers will be NaN and nothing will happen.
also tried cellwidth...no luck...guess the way i set width of cell is wrong?
I wrote handler as below...But it doesn't work...any idea?
Thanks
void OnInitializeRecord(object sender, Infragistics.Windows.DataPresenter.Events.InitializeRecordEventArgs e) { DataRecord dr = e.Record as DataRecord; if (dr != null && dr.ParentRecord != null) dr.Cells[0].Field.Settings.LabelWidth = dr.Cells[0].Field.Settings.LabelWidth - 20; }
If you will not be changing this cell's width, you can set it in the XAML. If you need to change it in runtime, you can use InitializeRecord event.