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
685
Checkbox on particular postion in xamdatagrid with header checkbox
posted

Hi

I am binding checkbox with header in InfraGrid uisng Resource. Now i want to set position of checkbox in fieldLayout's 3rd or any postion. I am able to do this with CellValuePresenter on that positon but unable to set header plz suggest how to resolve this

Code:

<igDP:XamDataGrid x:Name="grdTaxCodes"   GroupByAreaLocation="None"  Grid.Column="0" Grid.Row="1"
                                          AutoFit="True" Style="{StaticResource customBackground}" Theme="Print Basic">                                                   
                                <Style TargetType="{x:Type igDP:HeaderPrefixArea}" BasedOn="{x:Null}">
                                    <Setter Property="Width" Value="40"  />                                  
                                    <Setter Property="Template">
                                        <Setter.Value>
                                            <ControlTemplate TargetType="{x:Type igDP:HeaderPrefixArea}">
                                                <CheckBox  Name="chkSelectAll" HorizontalAlignment="Left" BorderThickness="1" Background="White" VerticalAlignment="Center"
                                                    IsChecked="{Binding Path=DataPresenter.DataContext.AllMembersAreChecked,Mode=TwoWay}" Margin="2,0,0,0" />
                                            </ControlTemplate>
                                        </Setter.Value>
                                    </Setter>
                                </Style>
                                <Style TargetType="{x:Type igDP:CellValuePresenter}" x:Key="ShowInGrid">
                                    <Setter Property="Visibility" Value="Visible" />
                                    <Setter Property="Width" Value="20" />
                                    <Setter Property="Template">
                                        <Setter.Value>
                                            <ControlTemplate TargetType="{x:Type igDP:CellValuePresenter}">
                                                <CheckBox IsChecked="{Binding Path=DataItem.IsChecked, Mode=TwoWay}"
                                                    Name="chkName" HorizontalAlignment="Center" VerticalAlignment="Center"  />
                                            </ControlTemplate>
                                        </Setter.Value>
                                    </Setter>
                                </Style>                               
                            </igDP:XamDataGrid.Resources>
                            <igDP:XamDataGrid.FieldSettings>
                                <igDP:FieldSettings AllowEdit="true" AllowSummaries="true" AllowGroupBy="False" AllowResize="True"
                                    AllowRecordFiltering="False" AllowCellVirtualization="True" AllowHiding="Never" />
                            </igDP:XamDataGrid.FieldSettings>
                            <igDP:XamDataGrid.FieldLayoutSettings >
                                <igDP:FieldLayoutSettings AutoGenerateFields="False"
                                                          DataRecordCellAreaStyle="{StaticResource customRecordArea}"/>
                            </igDP:XamDataGrid.FieldLayoutSettings>
                            <igDP:XamDataGrid.FieldLayouts>                                                                
                                <igDP:FieldLayout>                                   
                                    <igDP:FieldLayout.Fields>
                                        <igDP:Field Name="Id" Visibility="Collapsed" Width="*" >
                                        </igDP:Field>
                                        <igDP:Field Name="Code" Label="Tax Code" Width="100">
                                            <igDP:Field.Settings>
                                                <igDP:FieldSettings AllowEdit="False" />
                                            </igDP:Field.Settings>
                                        </igDP:Field>
                                        <igDP:Field Name="Desc" Label="Description" Width="300">
                                            <igDP:Field.Settings>
                                                <igDP:FieldSettings AllowEdit="False" />
                                            </igDP:Field.Settings>
                                        </igDP:Field>

<igDP:UnboundField Name="ShowInChart" Label="HeaderCheckbox here">
                                            <igDP:UnboundField.Settings>
                                                <igDP:FieldSettings CellValuePresenterStyle="{StaticResource ResourceKey=ShowInGrid}"  />
                                            </igDP:UnboundField.Settings>

                                        </igDP:UnboundField>                                        <igDP:Field Name="TaxCodeId" Label="MYOB Tax Code" Width="190" >
                                            <igDP:Field.Settings>
                                                <igDP:FieldSettings EditorStyle="{StaticResource MYOBTaxCodeComboBoxEditor}"  />
                                            </igDP:Field.Settings>
                                        </igDP:Field>
                                    </igDP:FieldLayout.Fields>
                                </igDP:FieldLayout>
                            </igDP:XamDataGrid.FieldLayouts>
                        </igDP:XamDataGrid>

 

Plz suggest where am i doing wrong

 

Parents
No Data
Reply
  • 2180
    Offline posted

    Hi,

    You have to define custom LabelPresenterStyle with a ContentTemplate and put the checkbox inside it. I am attaching a sample project. Let me know if you need any further assistance.

    Thanks,

    Diyan Dimitrov

    CheckBoxInHeader.zip
Children
No Data