This is a migrated thread and some comments may be shown as answers.
Getting an error while using ColumnGroupDescriptor in RadGridView in WPF
6 Answers 125 Views
This is a migrated thread and some comments may be shown as answers.
Vinod
Top achievements
Rank 1
Vinod asked on 19 Nov 2011, 12:28 PM
Hello Guys....I am getting an error while using ColumnGroupDescriptor in XAML,  to make a group based on some column....
if i do not use the following code in my xaml then it is working nicely and that code is:-

<telerik:RadGridView.GroupDescriptors>
                <telerik:ColumnGroupDescriptor Column="{Binding Columns[\PresentationName\], ElementName=telrikDataGrid}" SortDirection="Ascending" />
            </telerik:RadGridView.GroupDescriptors>


As i am using the above code the it showing a green underline...and showing a error as:
" NullReferenceException was thrown on "ColumnGroupDescriptor": Object reference not set to an instance of an object. " 

please guide me where i amm going wrong...please help me out ASAP.....Thank you guys...

i am also sending my project. So please find it as attachment.

Thanks!!!!!1
<Window x:Class="DataGridLoadingTest.MainWindow"
        xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation" 
        xmlns:local="clr-namespace:DataGridLoadingTest"
        xmlns:s="clr-namespace:System;assembly=mscorlib"
        xmlns:telerikData="clr-namespace:Telerik.Windows.Data;assembly=Telerik.Windows.Data"
        Title="MainWindow" Height="350" Width="600">
     
    <Window.Resources>
 
        <!--<src:BoolToVisiblityConverter x:Key="bool2vis"/>-->
        
 
    </Window.Resources>
     
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="20"/>
            <RowDefinition Height="*"/>
        </Grid.RowDefinitions>
         
       
          <Button Grid.Row="0"  Content="LoadData" Click="LaodData_Click" HorizontalAlignment="Right"/>
     
        <telerik:RadGridView x:Name="telrikDataGrid" Grid.Row="1" ShowColumnFooters="True" ShowGroupFooters="True"
                                     AlternateRowBackground="Azure" AlternationCount="2" AutoGenerateColumns="False"
                                     IsReadOnly="True">
 
 
            <telerik:RadGridView.Columns>
 
                <telerik:GridViewDataColumn Header="ID" DataMemberBinding="{Binding PresentationID}">
                    <telerik:GridViewDataColumn.AggregateFunctions>
                        <telerik:CountFunction Caption="Total Rows"/>
                    </telerik:GridViewDataColumn.AggregateFunctions>
                </telerik:GridViewDataColumn>
 
                <telerik:GridViewDataColumn Header="PresentationPath" DataMemberBinding="{Binding PresentationPath}" >
                </telerik:GridViewDataColumn>
 
 
                <telerik:GridViewDataColumn Header="PresentationName" DataMemberBinding="{Binding PresentationName}" >
                </telerik:GridViewDataColumn>
 
                <telerik:GridViewDataColumn Header="StratTime" DataMemberBinding="{Binding StartTime}">
                </telerik:GridViewDataColumn>
 
 
                <telerik:GridViewDataColumn Header="EndTime" DataMemberBinding="{Binding EndTime}">
                </telerik:GridViewDataColumn>
 
 
                <telerik:GridViewDataColumn Header="Duration(Sec)" DataMemberBinding="{Binding Duration}">
                    
                    <telerik:GridViewDataColumn.AggregateFunctions>
                        <telerik:SumFunction SourceFieldType="{x:Type s:Int64}" ResultFormatString="{}{0:d}" Caption="Total Duration: " SourceField="Duration"/>
                    </telerik:GridViewDataColumn.AggregateFunctions>
         
                </telerik:GridViewDataColumn>
 
                <telerik:GridViewDataColumn Header="LogLevel" DataMemberBinding="{Binding LogLevel}">
                </telerik:GridViewDataColumn>
 
                <telerik:GridViewDataColumn Header="Mode" DataMemberBinding="{Binding Mode}">
                </telerik:GridViewDataColumn>  
                 
            </telerik:RadGridView.Columns>
 
            <telerik:RadGridView.GroupDescriptors>
 
                <telerik:ColumnGroupDescriptor Column="{Binding Columns[\PresentationName\], ElementName=telrikDataGrid}" SortDirection="Ascending" />
            </telerik:RadGridView.GroupDescriptors>
             
             
        </telerik:RadGridView>
 
    </Grid>
</Window>
<Window x:Class="DataGridLoadingTest.MainWindow"
        xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation" 
        xmlns:local="clr-namespace:DataGridLoadingTest"
        xmlns:s="clr-namespace:System;assembly=mscorlib"
        xmlns:telerikData="clr-namespace:Telerik.Windows.Data;assembly=Telerik.Windows.Data"
        Title="MainWindow" Height="350" Width="600">
     
    <Window.Resources>
 
        <!--<src:BoolToVisiblityConverter x:Key="bool2vis"/>-->
        
 
    </Window.Resources>
     
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="20"/>
            <RowDefinition Height="*"/>
        </Grid.RowDefinitions>
         
       
          <Button Grid.Row="0"  Content="LoadData" Click="LaodData_Click" HorizontalAlignment="Right"/>
     
        <telerik:RadGridView x:Name="telrikDataGrid" Grid.Row="1" ShowColumnFooters="True" ShowGroupFooters="True"
                                     AlternateRowBackground="Azure" AlternationCount="2" AutoGenerateColumns="False"
                                     IsReadOnly="True">
 
 
            <telerik:RadGridView.Columns>
 
                <telerik:GridViewDataColumn Header="ID" DataMemberBinding="{Binding PresentationID}">
                    <telerik:GridViewDataColumn.AggregateFunctions>
                        <telerik:CountFunction Caption="Total Rows"/>
                    </telerik:GridViewDataColumn.AggregateFunctions>
                </telerik:GridViewDataColumn>
 
                <telerik:GridViewDataColumn Header="PresentationPath" DataMemberBinding="{Binding PresentationPath}" >
                </telerik:GridViewDataColumn>
 
 
                <telerik:GridViewDataColumn Header="PresentationName" DataMemberBinding="{Binding PresentationName}" >
                </telerik:GridViewDataColumn>
 
                <telerik:GridViewDataColumn Header="StratTime" DataMemberBinding="{Binding StartTime}">
                </telerik:GridViewDataColumn>
 
 
                <telerik:GridViewDataColumn Header="EndTime" DataMemberBinding="{Binding EndTime}">
                </telerik:GridViewDataColumn>
 
 
                <telerik:GridViewDataColumn Header="Duration(Sec)" DataMemberBinding="{Binding Duration}">
                    
                    <telerik:GridViewDataColumn.AggregateFunctions>
                        <telerik:SumFunction SourceFieldType="{x:Type s:Int64}" ResultFormatString="{}{0:d}" Caption="Total Duration: " SourceField="Duration"/>
                    </telerik:GridViewDataColumn.AggregateFunctions>
         
                </telerik:GridViewDataColumn>
 
                <telerik:GridViewDataColumn Header="LogLevel" DataMemberBinding="{Binding LogLevel}">
                </telerik:GridViewDataColumn>
 
                <telerik:GridViewDataColumn Header="Mode" DataMemberBinding="{Binding Mode}">
                </telerik:GridViewDataColumn>  
                 
            </telerik:RadGridView.Columns>
 
            <telerik:RadGridView.GroupDescriptors>
                <!--Here i am getting an error..i mean in the given line as " Object reference not set to an instance of an object.    "-->
                <telerik:ColumnGroupDescriptor Column="{Binding Columns[\PresentationName\], ElementName=telrikDataGrid}" SortDirection="Ascending" />
            </telerik:RadGridView.GroupDescriptors>
             
             
        </telerik:RadGridView>
 
    </Grid>
</Window>
 
 
                <telerik:GridViewDataColumn Header="EndTime" DataMemberBinding="{Binding EndTime}">
                </telerik:GridViewDataColumn>
 
 
                <telerik:GridViewDataColumn Header="Duration(Sec)" DataMemberBinding="{Binding Duration}">
                    
                    <telerik:GridViewDataColumn.AggregateFunctions>
                        <telerik:SumFunction SourceFieldType="{x:Type s:Int64}" ResultFormatString="{}{0:d}" Caption="Total Duration: " SourceField="Duration"/>
                    </telerik:GridViewDataColumn.AggregateFunctions>
         
                </telerik:GridViewDataColumn>
 
                <telerik:GridViewDataColumn Header="LogLevel" DataMemberBinding="{Binding LogLevel}">
                </telerik:GridViewDataColumn>
 
                <telerik:GridViewDataColumn Header="Mode" DataMemberBinding="{Binding Mode}">
                </telerik:GridViewDataColumn>  
                 
            </telerik:RadGridView.Columns>
 
            <telerik:RadGridView.GroupDescriptors>
 
                <telerik:ColumnGroupDescriptor Column="{Binding Columns[\PresentationName\], ElementName=telrikDataGrid}" SortDirection="Ascending" />
            </telerik:RadGridView.GroupDescriptors>
             
             
        </telerik:RadGridView>
 
    </Grid>
</Window>

6 Answers, 1 is accepted

Sort by
0
Stephen
Top achievements
Rank 1
answered on 02 Dec 2011, 07:47 PM
I'm having the exact same problem in Silverlight. Please help.
0
Vlad
Telerik team
answered on 05 Dec 2011, 08:15 AM
Hi,

 Unfortunately we are out of ideas what can cause this. A sample project where the problem can be reproduced will help us.

Best wishes,
Vlad
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

0
Licenses
Top achievements
Rank 1
answered on 29 Mar 2012, 11:22 PM
I have the same error!! Help
0
Rossen Hristov
Telerik team
answered on 30 Mar 2012, 08:49 AM
Hi,

Unfortunately we are out of ideas what can cause this. A sample project where the problem can be reproduced will help us. 

All the best,
Ross
the Telerik team
Sharpen your .NET Ninja skills! Attend Q1 webinar week and get a chance to win a license! Book your seat now >>
0
Licenses
Top achievements
Rank 1
answered on 03 Apr 2012, 01:52 PM

I solved, but using the index of the column, the column apparently can not be found by name or syntax that you indicate. (Columns [\ ColName \])

<telerik:ColumnGroupDescriptor Column="{Binding Columns[0], ElementName=Grid1}"/>
0
Fredy
Top achievements
Rank 1
answered on 24 Nov 2012, 01:17 PM

Add UniqueName

<telerik:GridViewDataColumn Header="PresentationName" DataMemberBinding="{Binding PresentationName}" UniqueName="PresentationName"  >
                </telerik:GridViewDataColumn>
Asked by
Vinod
Top achievements
Rank 1
Answers by
Stephen
Top achievements
Rank 1
Vlad
Telerik team
Licenses
Top achievements
Rank 1
Rossen Hristov
Telerik team
Fredy
Top achievements
Rank 1
Share this question
or