Programmatic grouping radgridview in XAML

4 posts, 1 answers
  1. Ramon
    Ramon avatar
    3 posts
    Member since:
    Sep 2011

    Posted 22 Nov 2011 Link to this post

    We tried to get the grouping of the radgridview done in the XAML using the groupdescriptors with both options

    For the information of the gridview look at the code we added.

    1)      Groupdescriptor with Member=”GemeenteList”  
    Errors we get

        Object is not set to an instance of an object (“Inner exception” )

    2)      Columngroupdescripter with Column=”{Binding Column[\GemeenteList\], ElementName=SteekproefradGridView}”
    Errors we get

        Object is not set to an instance of an object (“Inner exception” )


    Take in mind that we are binding the SteekproefradGridView immediately from the load operation, where we then divide the columns. So it is actually a direct binding to the entities of the stored procedure we did develop.

    Where the problem starts to develop I think is that the entity gets loaded in a way that is not yet divided in the columns at the first start and therefore there is no column to compare to. This is what we achieved once or twice we get the rows and they still have numbers 7981, 8000 and so on, and within them you can find the data we need. Sadly we cannot reproduce this anymore.

    So our questions would be:

    1)      Is it possible with our setup to group the radgridview in the XAML?

    2)      And If it is not possible how should we change the settings to get this to work?

           a)  By creating a class that holds all the information of the entities and then bind that class to the columns so that the data is immediately available

    3)      Is there possibly a work-around for this problem we are having?


    This is the normal radgridview code we use:

     

    <telerik:RadGridView HorizontalAlignment="Center" Margin="0" x:Name="SteekproefradGridView" VerticalAlignment="Top" IsFilteringAllowed="True" CanUserResizeColumns="False" CanUserReorderColumns="False" CanUserSortColumns="False" CanUserFreezeColumns="False" AutoGenerateColumns="False" CanUserDeleteRows="False" CanUserInsertRows="False" CanUserSelect="True" RowIndicatorVisibility="Collapsed" RowDetailsVisibilityMode="Visible" ShowColumnHeaders="True" ShowGroupPanel="True" MinWidth="200" ItemsSource="{Binding Source={StaticResource KlanttevredenheidViewModel}, Path=KlanttevredenheidDetailLoadop.AllEntities}" DataContext="{Binding Source={StaticResource KlanttevredenheidViewModel}}" ShowGroupFooters="True">

                <telerik:RadGridView.Columns>

                    <telerik:GridViewDataColumn Header="Gemeente" DataMemberBinding="{Binding GemeenteNaam}" UniqueName="GemeenteList" />

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

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

                    <telerik:GridViewDataColumn Header="WaardeNaWeging" DataMemberBinding="{Binding WaardeNaWeging}" IsVisible="False" />

                    <telerik:GridViewDataColumn Header="WegingsFactor" DataMemberBinding="{Binding WegingsFactor}" IsVisible="False" />

                    <telerik:GridViewExpressionColumn Header="Cijfer" Expression="WaardeNaweging/Wegingsfactor" DataFormatString="{}{0:0.0}"/>

                </telerik:RadGridView.Columns>

     

            </telerik:RadGridView>

     

    We hope that we can get an answer to the questions so we would be able to solve our problem.

    Thanks in advanced for all your help!

     

    Kind regards,

    Ramon

  2. Answer
    Vlad
    Admin
    Vlad avatar
    11100 posts

    Posted 22 Nov 2011 Link to this post

    Hello,

     This is possible only with Q3 2011. What is your version? You can check these demos for more info:
    http://demos.telerik.com/silverlight/#GridView/Aggregates
    http://demos.telerik.com/silverlight/#GridView/CustomAggregates
    http://demos.telerik.com/silverlight/#GridView/GroupByFormattedValue

    Best wishes,
    Vlad
    the Telerik team

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

  3. Ramon
    Ramon avatar
    3 posts
    Member since:
    Sep 2011

    Posted 22 Nov 2011 Link to this post

    Dear Vlad,

    We have tried these Columngroupdiscriptors but without luck, i have added an image that will show what the problem is when we try to group.

    We used the code below to get to the result of the image:


    <
    telerik:RadGridView HorizontalAlignment="Center" Margin="0" x:Name="SteekproefradGridView" VerticalAlignment="Top" IsFilteringAllowed="True" CanUserResizeColumns="False" CanUserReorderColumns="False" CanUserSortColumns="False" CanUserFreezeColumns="False" AutoGenerateColumns="False" CanUserDeleteRows="False" CanUserInsertRows="False" CanUserSelect="True" RowIndicatorVisibility="Collapsed" RowDetailsVisibilityMode="Visible" ShowColumnHeaders="True" ShowGroupPanel="True" MinWidth="200" ItemsSource="{Binding Source={StaticResource KlanttevredenheidViewModel}, Path=KlanttevredenheidDetailLoadop.AllEntities}" DataContext="{Binding Source={StaticResource KlanttevredenheidViewModel}}" ShowGroupFooters="True"> 
           <telerik:RadGridView.GroupDescriptors> 
                    <telerik:ColumnGroupDescriptor> 
                        <telerik:ColumnGroupDescriptor.Column> 
                            <telerik:GridViewColumn Header="Gemeente" ColumnGroupName="Gemeente" /> 
                        </telerik:ColumnGroupDescriptor.Column> 
                    </telerik:ColumnGroupDescriptor> 
                </telerik:RadGridView.GroupDescriptors> 
                <telerik:RadGridView.Columns> 
                    <telerik:GridViewDataColumn Header="Gemeente" DataMemberBinding="{Binding GemeenteNaam}" UniqueName="GemeenteList" /> 
                    <telerik:GridViewDataColumn Header="Leverancier" DataMemberBinding="{Binding NaamLeverancier}"  />
                    <telerik:GridViewDataColumn Header="Periode" DataMemberBinding="{Binding Periode}"  />
                    <telerik:GridViewDataColumn Header="WaardeNaWeging" DataMemberBinding="{Binding WaardeNaWeging}" IsVisible="False" /> 
                    <telerik:GridViewDataColumn Header="WegingsFactor" DataMemberBinding="{Binding WegingsFactor}" IsVisible="False" /> 
                    <telerik:GridViewExpressionColumn Header="Cijfer" Expression="WaardeNaweging/Wegingsfactor" DataFormatString="{}{0:0.0}"/> 
                </telerik:RadGridView.Columns> 
            </telerik:RadGridView>

    Kind regards,

    Ramon

  4. Ramon
    Ramon avatar
    3 posts
    Member since:
    Sep 2011

    Posted 22 Nov 2011 Link to this post

    Dear Vlad,

    We got it to work with the following code

    <telerik:RadGridView HorizontalAlignment="Center" Margin="0" x:Name="SteekproefradGridView" VerticalAlignment="Top" IsFilteringAllowed="True" CanUserResizeColumns="False" CanUserReorderColumns="False" CanUserSortColumns="False" CanUserFreezeColumns="False" AutoGenerateColumns="False" CanUserDeleteRows="False" CanUserInsertRows="False" CanUserSelect="True" RowIndicatorVisibility="Collapsed" RowDetailsVisibilityMode="Visible" ShowColumnHeaders="True" ShowGroupPanel="True" MinWidth="200" ItemsSource="{Binding Source={StaticResource KlanttevredenheidViewModel}, Path=KlanttevredenheidDetailLoadop.AllEntities}" DataContext="{Binding Source={StaticResource KlanttevredenheidViewModel}}" ShowGroupFooters="True">

                <telerik:RadGridView.Columns>

                    <telerik:GridViewDataColumn Header="Gemeente" DataMemberBinding="{Binding GemeenteNaam}" UniqueName="GemeenteNaam" />

                    <telerik:GridViewDataColumn Header="Leverancier" DataMemberBinding="{Binding NaamLeverancier}" UniqueName="NaamLeverancier" />

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

                    <telerik:GridViewDataColumn Header="WaardeNaWeging" DataMemberBinding="{Binding WaardeNaWeging}" IsVisible="False" />

                    <telerik:GridViewDataColumn Header="WegingsFactor" DataMemberBinding="{Binding WegingsFactor}" IsVisible="False" />

                    <telerik:GridViewExpressionColumn Header="Cijfer" Expression="WaardeNaweging/Wegingsfactor" DataFormatString="{}{0:0.0}"/>

                </telerik:RadGridView.Columns>

                <telerik:RadGridView.GroupDescriptors>

                    <telerik:ColumnGroupDescriptor>

                        <telerik:ColumnGroupDescriptor.Column>

                            <telerik:GridViewColumn Header="Gemeente" ColumnGroupName="GemeenteNaam" GroupMemberPath="GemeenteNaam" />

                        </telerik:ColumnGroupDescriptor.Column>

                    </telerik:ColumnGroupDescriptor>

                </telerik:RadGridView.GroupDescriptors>

            </telerik:RadGridView>


    Kind regards,

    Ramon
Back to Top