This is a migrated thread and some comments may be shown as answers.

RadGridView Banded Column Header

1 Answer 62 Views
This is a migrated thread and some comments may be shown as answers.
Top achievements
Rank 1
Berkay asked on 08 Feb 2012, 03:07 PM

We are using DevExpress wpf datagrid in our projects but we came into conflict on a very critical issue. We are creating our columns dynamically in a way compliant to MVVM pattern in our project. The column headers of columns created dynamically contains date information(year and week of year) as it can be seen in unbanded.png attached. but we want the column headers to be banded according to year month week  hierarchy as it is explained in banded.png attached. I have also attached the sample code that creates the columns.

This is a very critical issue for us because most of our project's  functionality comes from Grid. If Telerik grid can give us this flexibility we will be giving back our license to DevExpress and buy Telerik licenses for developers. We are on a very critical time schedule any solid proof (based on sample) that this can be done by telerik component will lead us to change our component source. Urgent response will be appreciated.



<Window x:Class="DynamicColumnSample.MainWindow"
        xmlns:dxb="" Title="MainWindow"
        xmlns:dx="" xmlns:DynamicColumnSanple="clr-namespace:DynamicColumnSample"
        <local:ViewModel />
        <my:ColumnTemplateSelector x:Key="ColumnTemplateSelector" />
        <DataTemplate x:Key="DefaultColumnTemplate">
                <dxg:GridColumn AllowEditing="False"
                                    my:ColumnBindingHelper.BindingPath="{Binding FieldName}"
                                    Header="{Binding Header}" />
        <DataTemplate x:Key="TextColumnTemplate">
                <dxg:GridColumn AllowEditing="True"
                                    my:ColumnBindingHelper.BindingPath="{Binding FieldName}"
                                Header="{Binding Header}"
                        <dxe:TextEditSettings Tag="{Binding Path=Tag}" ToolTip="{Binding Path=ToolTip}" />
        <dx:PopupBase Name="hitInfoPopup" Placement="Mouse" PlacementTarget="{Binding ElementName=treeListStoreUnitSchedule}" Opened="hitInfoPopup_Opened">
            <Grid Width="250" Height="250" Background="Beige">
                <Border Padding="12,8,24,10">
                    <ItemsControl Name="hitIfoItemsControl">
                                <StackPanel Orientation="Horizontal" >
                                    <TextBlock Text="{Binding Name}"></TextBlock>
                                    <TextBlock Text="{Binding Text}"></TextBlock>
        <dxg:GridControl x:Name="treeListStoreUnitSchedule"
                             ColumnGeneratorTemplateSelector="{StaticResource ColumnTemplateSelector}"
                             ColumnsSource="{Binding GridColumns}"
                             ItemsSource="{Binding RegionObjects}">
                <my:CustomChildrenSelector x:Key="childrenSelector" />
                <dxg:TreeListView x:Name="view"
                                  ChildNodesSelector="{StaticResource childrenSelector}"
                        <dxb:BarCheckItem Name="checkItem1" Content="Checked" IsChecked="True" dxb:BarItemLinkActionBase.ItemLinkIndex="0" />
                        <dxb:BarItemLinkSeparator dxb:BarItemLinkActionBase.ItemLinkIndex="1" />
BorderBrush="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type dxg:GridCellContentPresenter}}, Path=BorderBrush}"
BorderThickness="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type dxg:GridCellContentPresenter}}, Path=BorderThickness}">
                                <dxe:TextEdit x:Name="PART_Editor"/>
        <Button  Command="{Binding Path=AddCommand}" Content="Button" Height="23" HorizontalAlignment="Left" Margin="321,0,0,0" Name="button1" VerticalAlignment="Top" Width="75" />


private void PopulateMonthList() {
           try {
               ObservableCollection<MonthInfo> tmpMonthInfo = new ObservableCollection<MonthInfo>(){
                                                           new MonthInfo(){MonthName="2011-01", MonthNumber=201101},
                                                           new MonthInfo(){MonthName="2011-02", MonthNumber=201102},
                                                           new MonthInfo(){MonthName="2011-03", MonthNumber=201103},
                                                           new MonthInfo(){MonthName="2011-04", MonthNumber=201104},
                                                           new MonthInfo(){MonthName="2011-05", MonthNumber=201105},
                                                           new MonthInfo(){MonthName="2011-06", MonthNumber=201106},
                                                           new MonthInfo(){MonthName="2011-07", MonthNumber=201107},
                                                           new MonthInfo(){MonthName="2011-08", MonthNumber=201108},
                                                           new MonthInfo(){MonthName="2011-09", MonthNumber=201109},
                                                           new MonthInfo(){MonthName="2011-10", MonthNumber=201110},
                                                           new MonthInfo(){MonthName="2011-11", MonthNumber=201111},
                                                           new MonthInfo(){MonthName="2011-12", MonthNumber=201112},
                                                           new MonthInfo(){MonthName="2012-01", MonthNumber=201201},
               TextColumn txtColumn = null;
               for (int i = 0; i < 13; i++) {
                   txtColumn = new TextColumn();
                   txtColumn.FieldName = "SalesInfoObject[" + i.ToString() + "].Quantity";
                   txtColumn.Header = tmpMonthInfo[i].MonthName.ToString();
                   txtColumn.Setting = SettingsType.Text;
                   txtColumn.Tag = "SalesInfoObject[" + i.ToString() + "]";
                   txtColumn.ToolTip = "SalesInfoObject[" + i.ToString() + "]" + "].Brand";
               _gridColumns.Insert(0, new GridColumn() { Header = "Store Region", FieldName = "Name", Setting = SettingsType.Default });
               _gridColumns.Insert(1, new GridColumn() { Header = "Store Quantity", FieldName = "Count", Setting = SettingsType.Default });
           } catch (Exception ex) {
               throw ex;

1 Answer, 1 is accepted

Sort by
Telerik team
answered on 08 Feb 2012, 03:10 PM

 Please check this demo for more info. The example is for Silverlight however you will find exactly the same in your local copy our of WPF demos. 

Kind regards,
the Telerik team
Sharpen your .NET Ninja skills! Attend Q1 webinar week and get a chance to win a license! Book your seat now >>
Asked by
Top achievements
Rank 1
Answers by
Telerik team
Share this question