Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
985
Select Specific columns from Datasource
posted

Hello Infragistics team,

My xamdatagrid is bound to an ienumerable observable collection. I want to show only specific columns from the collection. I am unable able to do this, when I include a checkbox column in the xamdatagrid. Below is my xaml code:

<igWPF:XamDataGrid IsGroupByAreaExpanded="False" GroupByAreaLocation="None" HorizontalAlignment="Left" Margin="21,96,0,0" Name="xamDataGrid1" VerticalAlignment="Top" Height="271" Width="453"
DataSource="{Binding Disciplines}"
Theme="IGTheme"
>
<igWPF:XamDataGrid.Resources>
<!-- This Style puts a CheckBox into the record selectors. -->
<Style TargetType="{x:Type igWPF:RecordSelector}"
BasedOn="{x:Null}">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type igWPF:RecordSelector}">
<CheckBox HorizontalAlignment="Center"
VerticalAlignment="Center"
IsChecked="{Binding Path=DataItem.IsChecked, Mode=TwoWay}" />
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>

<!-- This Style puts a CheckBox into the header area above the record selectors. -->
<Style TargetType="{x:Type igWPF:HeaderPrefixArea}"
BasedOn="{x:Null}">
<Setter Property="Visibility"
Value="Visible" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type igWPF:HeaderPrefixArea}">
<CheckBox HorizontalAlignment="Center"
VerticalAlignment="Center"
IsChecked="{Binding Path=DataPresenter.DataContext.AllMembersAreChecked, Mode=TwoWay}" />
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</igWPF:XamDataGrid.Resources>
<!--#BEGIN SNIPPET#-->

<igWPF:XamDataGrid.FieldLayouts>
<igWPF:FieldLayout>
<igWPF:FieldLayout.Fields>
<igWPF:Field Name="G4_DI_Desc" Label="Disciplines" />
<igWPF:Field Name="G4_DI_Code" Label="Code" />
<igWPF:Field Name="IsChecked" Visibility="Collapsed" />
</igWPF:FieldLayout.Fields>
</igWPF:FieldLayout>
</igWPF:XamDataGrid.FieldLayouts>
<!--#END SNIPPET#-->
</igWPF:XamDataGrid>

I only want to include these two columns: G4_DI_Desc & G4_DI_Code in addition to the checkboxes column. How to achieve this?

Thank you