I am binding RadGridView with single list called Data, I want to show GridViewDataColumn header(Column1) on top of RadGridView.Columns and GroupDescr

2 posts, 0 answers
  1. saji
    saji avatar
    1 posts
    Member since:
    May 2015

    Posted 26 May 2015 Link to this post



       <telerik:RadGridView Name="DataGrid"
    ItemsSource="{Binding Data}" ScrollViewer.CanContentScroll="True"  

                                            ScrollViewer.VerticalScrollBarVisibility="Auto"
    ScrollViewer.HorizontalScrollBarVisibility="Auto" Grid.Row="0"

                                            IsReadOnly="True"
    IsFilteringAllowed="False" RowIndicatorVisibility="Collapsed" ShowGroupPanel="False"

                                            AutoGenerateColumns="False"   ShowColumnFooters="True"  AutoExpandGroups="True"
    CanUserFreezeColumns="False"

                  SelectionMode="Extended" SelectionUnit="FullRow"     ShowInsertRow="False"   CanUserInsertRows="False"
    CanUserDeleteRows="False" CanUserReorderColumns="False"

                                             CanUserResizeColumns="False"
    CanUserSortColumns="False"   >

     

     

                                    <telerik:RadGridView.Columns>

     

     

                                        <telerik:GridViewDataColumn DataMemberBinding="{Binding Column1}" Header="Column1"   />

                                        <telerik:GridViewDataColumn DataMemberBinding="{Binding Column2}" Header="Column2" />

     

     

     

     

     

                                    </telerik:RadGridView.Columns>

                                    <telerik:RadGridView.GroupRowStyle>

                                        <Style TargetType="telerik:GridViewGroupRow">

                                            <Setter Property="ShowHeaderAggregates" Value="False"></Setter>

                                        </Style>

                                    </telerik:RadGridView.GroupRowStyle>

                                    <telerik:RadGridView.GroupHeaderTemplate>

                                        <DataTemplate>

                                            <StackPanel Orientation="Horizontal" Margin="0,0" Height="45">

                                                <TextBlock Text="{Binding Group.Key}" Margin="0,0,0,2" Width="200" />

                                                <telerik:AggregateResultsList ItemsSource="{Binding AggregateResults}" VerticalAlignment="Center">

                                                   
    <ItemsControl.ItemTemplate>

                                                        <DataTemplate>

                                                           
    <StackPanel Orientation="Vertical" VerticalAlignment="Center">

                                                               
    <TextBlock VerticalAlignment="Center" HorizontalAlignment="Center" Text="{Binding Caption}" Width="90" />

                                                               
    <TextBlock VerticalAlignment="Center" HorizontalAlignment="Center" Text="{Binding FormattedValue}" Width="90"  />

                                                           
    </StackPanel>

                                                       
    </DataTemplate>

                                                   
    </ItemsControl.ItemTemplate>

                                                    <ItemsControl.ItemsPanel>

                                                       
    <ItemsPanelTemplate>

                                                           
    <StackPanel Orientation="Horizontal"
    />

                                                     
      </ItemsPanelTemplate>

                                                   
    </ItemsControl.ItemsPanel>

                                                </telerik:AggregateResultsList>

                                            </StackPanel>

     

                                        </DataTemplate>

                                    </telerik:RadGridView.GroupHeaderTemplate>

     

                                    <telerik:RadGridView.GroupDescriptors>

                                        <telerik:GroupDescriptor x:Name="TransactionGroup" Member="Group1" SortDirection="Ascending"
    >

                                            <telerik:GroupDescriptor.AggregateFunctions>

                                                <telerik:MinFunction SourceField="GroupHeader1"  Caption="GroupHeader1" />

                                                <telerik:MinFunction SourceField="GroupHeader2" Caption="GroupHeader2" />

                                            </telerik:GroupDescriptor.AggregateFunctions>

                                        </telerik:GroupDescriptor>

                                    </telerik:RadGridView.GroupDescriptors>

     

     

                                </telerik:RadGridView>

     

     

     

     

  2. Dimitrina
    Admin
    Dimitrina avatar
    3769 posts

    Posted 28 May 2015 Link to this post

    Hi,

    Looking at the attached image, I am not sure what you would like to achieve.
    Generally, you can refer to the documentation on:
    Columns
    Grouping.

    You can also find some examples available with WPF Demos.

    Regards,
    Dimitrina
    Telerik
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Back to Top