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

Unable to group gridview

2 Answers 55 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Joseph
Top achievements
Rank 1
Joseph asked on 03 Dec 2010, 12:42 AM
Hi,
I'm new to Telerik and have just downloaded the latest WPF trial.
I'm having trouble with the Gridview (version 2010.3.1110.35).
I'll post the XAML below, but I'm populating from an observableCollection pulled from a WCF service.
The grid populates OK, but I cannot group the columns please can you advise.
The window is binding to an ViewModel.

I've tried another sample wher I create some objects on the fly, putting them into an observableCollection and binding to it ... and
the grouping has worked fine.

Many thanks,
Joseph.

<Window x:Class="VisionRT.CRM.WPF.TelerikMainWindow"
        mc:Ignorable="d"
        DataContext="{Binding Main, Source={StaticResource Locator}}"
        xmlns:telerikData="clr-namespace:Telerik.Windows.Data;assembly=Telerik.Windows.Data"
        xmlns:telerikControls="clr-namespace:Telerik.Windows.Controls;assembly=Telerik.Windows.Controls"
        xmlns:System="clr-namespace:System;assembly=mscorlib"
        d:DesignHeight="390"
        d:DesignWidth="729"
        Width="650" Loaded="Window_Loaded">
 
    <Grid>
        <telerik:RadGridView HorizontalAlignment="Stretch" Margin="12,62,12,0" Name="radGridView1"                             
                             ItemsSource="{Binding Path=ContactList, Mode=TwoWay}"
                             AutoGenerateColumns="False"
                             IsSynchronizedWithCurrentItem="True"
                             VerticalAlignment="Top" Height="248">
            <telerik:RadGridView.Columns>
                <telerik:GridViewDataColumn Header="Title" DataMemberBinding="{Binding Title}"  Width="*" IsGroupable="True" >
                    <telerik:GridViewDataColumn.AggregateFunctions>
                        <telerikData:CountFunction Caption="Count: " />
                    </telerik:GridViewDataColumn.AggregateFunctions>
                </telerik:GridViewDataColumn>
                <telerik:GridViewDataColumn Header="First Name" DataMemberBinding="{Binding FirstName}" Width="*"   IsGroupable="True" />
            </telerik:RadGridView.Columns>
        </telerik:RadGridView>
    </Grid>
</Window>
 

2 Answers, 1 is accepted

Sort by
0
Joseph
Top achievements
Rank 1
answered on 03 Dec 2010, 02:08 AM
Hi,

Think I've found the culprit.
I was doing this in the Window_Loaded method...
StyleManager.SetTheme(radGridView1, new Office_BlueTheme()); 
Moving that into the constructor seemed to make the problem go away.

Please could someone confirm this as a problem... Or, was I wrong putting that line of code in the
Window_Loaded method?

Thanks,
Joseph. 
0
Vanya Pavlova
Telerik team
answered on 06 Dec 2010, 01:46 PM
Hello Joseph,


Window's Loaded event is to late to set a theme, it is working in InitializeComponent because that is the right place.

Best wishes,
Vanya Pavlova
the Telerik team
Browse the videos here>> to help you get started with RadControls for WPF
Tags
GridView
Asked by
Joseph
Top achievements
Rank 1
Answers by
Joseph
Top achievements
Rank 1
Vanya Pavlova
Telerik team
Share this question
or