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
30
Field label template is not being displayed in the sorted column header
posted

I'm using a XamDataGrid and customizing my field layout so I can insert a checkbox into the header label. Then I'm sorting the field so I have multiple sections, and I end up wth the checkbox only displaying in one of the two grid headers. Not sure how I can get it to display in both?

                    <dataPresenter:XamDataGrid x:Name="FwModuleGrid" b:XamDataGridBehavior.ExpandGroups="True" DataSource="{Binding UpgradableModules}" IsNestedDataDisplayEnabled="False" Style="{DynamicResource DefaultXamDataGridStyle}">
                        <dataPresenter:XamDataGrid.FieldLayoutSettings>
                            <b:XamDataGridDefaultFieldLayoutSettings AllowClipboardOperations="Copy"
                                                                     AutoFitMode="ExtendLastField"
                                                                     AutoGenerateFields="False"
                                                                     CopyFieldLabelsToClipboard="True"
                                                                     DataRecordCellAreaStyle="{DynamicResource DefaultXamDataGridDataRecordCellArea}"
                                                                     RecordSelectorLocation="None"
                                                                     SelectionTypeRecord="Extended"
                                                                     GroupByRecordChildIndent="0"/>
                        </dataPresenter:XamDataGrid.FieldLayoutSettings>
                        <dataPresenter:XamDataGrid.FieldSettings>
                            <dataPresenter:FieldSettings AllowRecordFiltering="False"
                                                         AutoSizeOptions="All"
                                                         AutoSizeScope="AllRecords"
                                                         CellClickAction="EnterEditModeIfAllowed"
                                                         EditModeBehaviorOnDataUpdate="UpdateEditValue" />
                        </dataPresenter:XamDataGrid.FieldSettings>
                        <dataPresenter:XamDataGrid.FieldLayouts>
                            <dataPresenter:FieldLayout>
                                <dataPresenter:FieldLayout.SortedFields>
                                    <dataPresenter:FieldSortDescription Direction="Descending" FieldName="System" IsGroupBy="True" />
                                    <dataPresenter:FieldSortDescription Direction="Descending" FieldName="Base" IsGroupBy="True" />
                                    <dataPresenter:FieldSortDescription Direction="Ascending" FieldName="Slot" />
                                </dataPresenter:FieldLayout.SortedFields>
                                <dataPresenter:Field Name="IsSelected" Width="Auto" HorizontalContentAlignment="Left" IsEnabled="{Binding CanSelect}" ToolTip="{x:Static strings:AutoStrings.Selected}">
				    <! -- This works for a single field, but when I add multiple fields with the field sorting it only shows up in the last field label -->   
                                    <dataPresenter:Field.Label>
                                        <ContentControl Content="{Binding DataContext, RelativeSource={RelativeSource AncestorType={x:Type dataPresenter:XamDataGrid}}}">
                                            <ContentControl.ContentTemplate>
                                                <DataTemplate >
                                                    <CheckBox IsChecked="{Binding IsAllChecked}"
                                                              IsThreeState="True"
                                                              IsEnabled="{Binding Path=DataItem.CanSelect}"
                                                              ToolTip="{x:Static strings:AutoStrings.SelectAll}" />
                                                </DataTemplate>
                                            </ContentControl.ContentTemplate>
                                        </ContentControl>
                                    </dataPresenter:Field.Label>
                                    <dataPresenter:Field.Settings>
                                        <dataPresenter:FieldSettings EditAsType="{x:Type sys:Boolean}" LabelClickAction="Nothing">
                                            <dataPresenter:FieldSettings.CellValuePresenterStyle>
                                                <Style TargetType="{x:Type dataPresenter:CellValuePresenter}">
                                                    <Setter Property="Value" Value="{Binding Path=DataItem.IsSelected}" />
                                                    <Setter Property="ToolTip" Value="{x:Static strings:AutoStrings.Selected}" />
                                                    <Setter Property="Tag" Value="{Binding Path=DataItem}" />
                                                    <Setter Property="IsEnabled" Value="{Binding Path=DataItem.CanSelect}" />
                                                    <Setter Property="Margin" Value="6" />
                                                    <Setter Property="Width" Value="Auto" />
                                                    <Setter Property="Template">
                                                        <Setter.Value>
                                                            <ControlTemplate TargetType="{x:Type dataPresenter:CellValuePresenter}">
                                                                <CheckBox IsChecked="{Binding Path=Tag.IsSelected, RelativeSource={RelativeSource AncestorType={x:Type dataPresenter:CellValuePresenter}}}" />
                                                            </ControlTemplate>
                                                        </Setter.Value>
                                                    </Setter>
                                                </Style>
                                            </dataPresenter:FieldSettings.CellValuePresenterStyle>
                                        </dataPresenter:FieldSettings>
                                    </dataPresenter:Field.Settings>
                                </dataPresenter:Field>
				<! -- other fields here -->                              
                            </dataPresenter:FieldLayout>
                        </dataPresenter:XamDataGrid.FieldLayouts>
                    </dataPresenter:XamDataGrid>

You can see the bottom column header label displays the checkbox, but the top one is missing. Normally I would think this is an issue with sharing the template between columns, so I tried turning the content presenter into a resource and then tagged it as x:Shared="false", but that didn't seem to do anything.

Any help would be appreciated!

Parents
No Data
Reply
  • 1660
    Offline posted

    Hello James,

    I noticed that there is another forum thread regarding the same query. Please, keep in mind that according to our support policy we handle singe thread per issues. This helps us ensure that all issues are addressed and handled correctly.

    Please have a look at this forum thread where I have already provided an answer and let me know if you have any additional questions. 

    Thank you for using Infragistics components.

    Regards,
    Ivan Kitanov

Children
No Data