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

synchronised subgrid

6 Answers 157 Views
GridView
This is a migrated thread and some comments may be shown as answers.
marc
Top achievements
Rank 1
marc asked on 16 Aug 2011, 10:14 AM
I have a radgridview displaying in the rowdetail of another radgridview. a list of sublists. this works nicely. now i want to make sure that the columns of the sublists are all synchronised. to do this, i was thinking of registering the loaded inner lists and using the changing/changed events of the columns. I am currently still having difficulties, finding the right information within the events (changed column number, current width), but I am more concerned about other issues. how are these rowdetails handled, are they unloaded when closed? I guess i should then unregister the detail. what happens when scrolled out of visible area? as the radgridcontrol can handle a large amount of data, i can imagine i must take a few things into account i have not yet thought about.

<radgridview>
<RadGridView.RowDetailsTemplate>
<DataTemplate>
<radgridview ColumnWidthChanging="gridView_ColumnWidthChanging"
ColumnWidthChanged="gridView_ColumnWidthChanged"
Loaded="gridView_Loaded"/>
</DataTemplate>
</RadGridView.RowDetailsTemplate>
</radgridview>

I am fairly new to wpf and very new to the radcontrols, so be kind ;) ...

6 Answers, 1 is accepted

Sort by
0
Vanya Pavlova
Telerik team
answered on 16 Aug 2011, 10:24 AM
Hi Marc,

 
You may take a look at the following forum thread "Sharing Parent column width in child grid" for further reference. The same approach is applicable to WPF as well. 



Kind regards,
Vanya Pavlova
the Telerik team

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

0
marc
Top achievements
Rank 1
answered on 16 Aug 2011, 12:35 PM
I've managed to synchronise the column widths of the subgrids using the columnwidthchanging event. I am also using the load and unload events for the details and hope this will suffice.

 Now i need to be able to synchronise sorting and moving around columns. When checking the online documentation, I was expecting SortChanged and ColumnIndexChanged should do the trick. The thing is SortChanged does not seem to exist and the documentation states that ColumnIndexChanged is obsolete, but offers no new alternative. I then checked the offline documentation and came across "ColumnReorderd" and "Sorted". No real clue how to handle them, so i just went along and tried.

by setting "sublist[i].Columns[name].DisplayIndex" i managed to change the positioning of the columns with the event "ColumnReorderd". cool.
With the event "Sorted" I tried updating "sublist[i].Columns[name].SortingState = sortingState;". This changed the column header, but did not sort the list.

Both approaches seem valid (but a little dangerous, as I dont know what i am doing), but for some reason only the first one works. Any suggestions?
0
Vanya Pavlova
Telerik team
answered on 16 Aug 2011, 03:54 PM
Hi Marc,

 


The proposed solution in the previously referenced thread is just a simple demonstration of synchronising columns between parent and child grid views using attached behaviors. For the rest of your requirements I believe that there is no straight-forward way to implement such a behavior. I would recommend you to use our RadTreeListView component in such case, which provides this built-in functionality.


You may refer to our online documentation for further information, please follow this link. 



Greetings,
Vanya Pavlova
the Telerik team

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

0
marc
Top achievements
Rank 1
answered on 17 Aug 2011, 09:09 AM
thanks for the reply vanya.
the treeview unfortunately will not do the trick (please correct me if I am mistaken). The columns of the sublist are not to be in line with the columns of the parent gridm, they contain independant information. Is there a way to to transfer sorting information from one radgridview to another? Currently seems like I must do this in a pretty hacky fashion and its not working smoothly so far.
0
marc
Top achievements
Rank 1
answered on 17 Aug 2011, 11:03 AM
I have finally found a solution that seems to work well. I add a new SortDescriptor for every SubList after removing all previous sorting information. I have noticed that vertical scrolling is not always fluid, would this be due to loading/unloading of detail information?
0
Vanya Pavlova
Telerik team
answered on 17 Aug 2011, 01:18 PM
Hello Marc,

 


I am glad to hear that you were able to find a solution for your custom scenario by your side.
I am not quite sure what do you mean by "fluid" vertical scrolling. Initially RadGridView does not know anything about your hierarchy and the number of levels it contains. When it has been loaded we measure these levels and everything is being recalculated. The only thing you may do is to turn RadGridView's virtualization off, through setting EnableColumnVirtualization to False (or respectively EnableRowVirtualization to False). 


Kind regards,
Vanya Pavlova
the Telerik team

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

Tags
GridView
Asked by
marc
Top achievements
Rank 1
Answers by
Vanya Pavlova
Telerik team
marc
Top achievements
Rank 1
Share this question
or