Welcome to the Xceed Community | Help
Community Search  

How to set different GroupHeaders

Sort Posts: Previous Next
  •  12-03-2008, 9:13 AM Post no. 17324

    How to set different GroupHeaders

    Hi,

    How can different GroupHeaders depending on columns be set?

    I have a grid with a collectionviewsource defined and initial grouping set on the collectionviewsource.

    I have this Group Template defined in the  resources of the grid (which should be applied for all columns except one):

                    <DataTemplate DataType="{x:Type xcdg:Group}">
                        <StackPanel Orientation="Horizontal">
                            <TextBlock Text="{Binding Value}" />
                            <TextBlock Text=" (" />
                            <TextBlock Text="{Binding Items.Count}" />
                            <TextBlock Text=")" />
                        </StackPanel>
                    </DataTemplate>

     

    For the one special column I need following cause the underlying DataItem has a complex structure with a custom content template and a "Description" property that should be used in the grouping header:

                    <DataTemplate DataType="{x:Type xcdg:Group}">
                        <StackPanel Orientation="Horizontal">
                            <TextBlock Text="{Binding Value.Description}" />
                            <TextBlock Text=" (" />
                            <TextBlock Text="{Binding Items.Count}" />
                            <TextBlock Text=")" />
                        </StackPanel>
                    </DataTemplate>

     How can I reach this?

     

    If it helps here is the column definition:

    <xcdg:Column FieldName="BreakDefType" Title="AreaType">

                        <xceed:Column.CellContentTemplate>
                            <DataTemplate>
                                <TextBlock Text="{Binding Path=Description}" />
                            </DataTemplate>
                        </xceed:Column.CellContentTemplate>

                        <xcdg:Column.CellEditor>
                            <xcdg:CellEditor x:Name="_uiSceneTypeCellEditor">
                                <xcdg:CellEditor.EditTemplate>
                                    <DataTemplate>
                                        <ComboBox
                                            VerticalAlignment="Top"
                                            VirtualizingStackPanel.IsVirtualizing="True"
                                            VirtualizingStackPanel.VirtualizationMode="Recycling"
                                            xcdg:DataCell.IsCellFocusScope="True" MaxHeight="25"
                                            SelectedItem="{xcdg:CellEditorBinding}"
                                            ItemsSource="{Binding RelativeSource={RelativeSource AncestorType={x:Type BreakDefinitions:BreakDefinitionsView}}, Path=DataContext.AllDefinitionTypes, Mode=OneWay}"
                                            Background="{Binding RelativeSource={RelativeSource AncestorType={x:Type xceed:Cell}}, Path=Background, Mode=OneWay}">
                                            <ComboBox.ItemTemplate>
                                                <DataTemplate>
                                                    <TextBlock Text="{Binding Path=Description}" />
                                                </DataTemplate>
                                            </ComboBox.ItemTemplate>
                                        </ComboBox>
                                    </DataTemplate>
                                </xcdg:CellEditor.EditTemplate>
                            </xcdg:CellEditor>
                        </xcdg:Column.CellEditor>
                    </xcdg:Column>

     
     

    Please help!

    Andreas

    Filed under:
  •  12-05-2008, 9:51 AM Post no. 17365 in reply to 17324

    Re: How to set different GroupHeaders

    Just found a working solution on my own. :-)

    Overring the ToString() method in the underlying type which is then used in the grouping header textbox was enough.

     

    public override string ToString()
    {
                return Description;
    }

    Nevertheless, when I have a more complicated datatemplate in the grouping header, the problem remains.

    Bye.

View as RSS news feed in XML
Contact | Site Map | Reviews | Legal Terms of Use | Trademarks | Privacy Statement Copyright 2008 Xceed Software Inc.