The following XAML shows that I want to create ColumnGroups at run time same as like XAML code (which is following) based on business requirement which is not constant. How to do that in code behind I am unable to add. Please send me the code snippet.
=====================================================================================================
CanUserFreezeColumns="False" ShowGroupPanel="true" RowIndicatorVisibility="Collapsed" Width="Auto"
ScrollViewer.VerticalScrollBarVisibility="auto" ScrollViewer.CanContentScroll="True" ScrollViewer.HorizontalScrollBarVisibility="auto" SnapsToDevicePixels="False" VerticalContentAlignment="Top"
ItemsSource="{Binding TempGridData,Mode=OneWay}" CanUserResizeColumns="False" SelectionMode="Single" SelectionUnit="FullRow" SelectedItem="{Binding SelectedGridItem,Mode=TwoWay}"
Background="#EAF3FC" >
<!--It creates a column group in which we can merge column headers as needed-->
<!--1st group Header for the 1st month -->
<Tele:RadGridView.ColumnGroups>
<Tele:GridViewColumnGroup Name="MonthName1" >
<Tele:GridViewColumnGroup.HeaderTemplate>
<DataTemplate>
<Grid HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Background="#EAF3FC" Name="grdcolumnHeader1" >
<Grid.RowDefinitions>
<RowDefinition Height="23"></RowDefinition>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"></ColumnDefinition>
<ColumnDefinition Width="Auto"></ColumnDefinition>
</Grid.ColumnDefinitions>
<Label Name="lblMonthName1" Grid.Row="0" Grid.Column="0" HorizontalAlignment="Stretch" HorizontalContentAlignment="Center" VerticalAlignment="Stretch" Padding="0" Margin="0,2,0,0" FontWeight="DemiBold"
Content="{Binding Path=DataContext.MonthName1,RelativeSource={RelativeSource FindAncestor,AncestorType={x:Type Tele:GridViewDataControl}}}" ></Label>
<StackPanel Grid.Row="0" Grid.Column="1" Orientation="Horizontal" HorizontalAlignment="Stretch" Width="Auto" Name="sPanel1"
Visibility="{Binding Path=DataContext.SPanel1,RelativeSource={RelativeSource FindAncestor,AncestorType={x:Type Tele:GridViewDataControl}}}">
<Button Name="btnFirst" HorizontalAlignment="Center" VerticalAlignment="Center" Content="<<"/>
<Button Name="btnPrevious" HorizontalAlignment="Center" VerticalAlignment="Center" Content="<"/>
<Button Name="btnNext" HorizontalAlignment="Center" VerticalAlignment="Center" Content=">" Click="btnNext_Click"/>
<Button Name="btnLast" HorizontalAlignment="Center" VerticalAlignment="Center" Content=">>"/>
</StackPanel>
</Grid>
</DataTemplate>
</Tele:GridViewColumnGroup.HeaderTemplate>
</Tele:GridViewColumnGroup>
</Tele:RadGridView.ColumnGroups>
Thanks
Laxman.