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

Programatically grouping

4 Answers 114 Views
GridView
This is a migrated thread and some comments may be shown as answers.
TSRG - IT
Top achievements
Rank 1
TSRG - IT asked on 23 Mar 2010, 06:28 AM
Hi all,

I'm writing an app the MVVM way and have set up a ViewModel to bind to a view, which is a user control that contains a RadGridView. The data binds correctly and am able to see this however there are 3 group descriptors I wish to add and when I add this programmatically, the grid duplicates my rows, so now, my grid contains a duplicate or of each row. One type of the rows containing the full grouping while the other only with 2 of my 3 groupings. If I remove the groupings manually from the grid and re-add these they work perfectly (without duplicate rows). I am adding the group descriptions on the RadGridView_Load event. In the same event I also programmatically create columns.

Any help would be great.

Cheers,

Tim.

4 Answers, 1 is accepted

Sort by
0
Vlad
Telerik team
answered on 23 Mar 2010, 07:48 AM
Hi Tim,

Can you post more info about the grid XAML declaration and version?

Best wishes,
Vlad
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
TSRG - IT
Top achievements
Rank 1
answered on 23 Mar 2010, 08:02 AM
Sure - I've followed closely with Josh Smith's example in his MVVM article. I've set up an ObservableCollection of workspaces which I add ViewModels to, in this case, when an object of AllModelFlowsViewModel is created and added to this workspace the view ModelFlowView is applied to it.

This is the xaml:

 

 

<DataTemplate DataType="{x:Type vmGridModelFlow:AllModelFlowsViewModel}">

 

 

 

<vw:ModelFlowView StartPeriod="{Binding StartPeriod}" EndPeriod="{Binding EndPeriod}"/>

 

 

 

</DataTemplate>

 

ModelFlowView is a user control with a RadGridView and AllModeFlowsViewModel is the view model containing a binding list which I populate and bind to this view. The following is the declaration of my RadGridView in the user control.

<

 

telerikGrid:RadGridView x:Name="ModelFlowGridView" HorizontalAlignment="Stretch"

 

 

 

 

 

VerticalAlignment="Stretch" Width="Auto" Height="Auto"

 

 

 

 

 

EnableColumnVirtualization="False" EnableRowVirtualization="False"

 

 

 

 

 

AutoGenerateColumns="False" FrozenColumnCount="0"

 

 

DataLoadMode ="Asynchronous"

 

 

 

 

 

ShowGroupPanel="True"

 

 

RowLoaded="ModelFlowGridView_RowLoaded"

 

 

 

 

 

CellValidating="ModelFlowGridView_CellValidating"

 

 

 

 

 

BeginningEdit="ModelFlowGridView_BeginningEdit"

 

 

ItemsSource="{Binding ModelFlowWithOutcomes}"/>

I've attached a screenshot of my grid in action. I've highlighted a set of rows, they have been duplicated, you can see that the set at the top have an additional grouping (Phase) however the set at the bottom do not. If I remove the "Phase" grouping at the top, the duplicate rows are removed from the grid.

Please advise if you need more information.

Thank you very much.

 

0
Accepted
Vlad
Telerik team
answered on 23 Mar 2010, 08:10 AM
Hello Tim,

I'm still not sure about the grid version however please remove temporary DataLoadMode ="Asynchronous" to see what will the result.

Best wishes,
Vlad
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
TSRG - IT
Top achievements
Rank 1
answered on 23 Mar 2010, 08:27 AM
Sorry I'm using the latest version of the Telerik controls, Q4 2010 - this only started to happen when I upgraded from Q3.

Anyway, you're great, that worked, thanks a lot!
Tags
GridView
Asked by
TSRG - IT
Top achievements
Rank 1
Answers by
Vlad
Telerik team
TSRG - IT
Top achievements
Rank 1
Share this question
or