User (Old forums)MemberAugust 29, 2007 at 12:27 pmPost count: 23064
I’ve been trying to follow various examples to listen on the GroupingUpdated events, in particular to hide columns from view when they are grouped.
However, if I for example try
grid.GroupingUpdated += new EventHandler(grid_GroupingUpdated);
I get Error ‘Xceed.Wpf.DataGrid.DataGridControl’ does not contain a definition for ‘GroupingUpdated’
It’s obvious that I’m trying to access the event in a manner that only works for the .NET datagrid. I’ve been trying to find out how to do the same with the WPF datagrid, but without any luck (should the events be defined/hooked in the xaml perhaps?).
In any case, the example I’ve been trying to follow is: http://forums.xceed.com/forums/ShowPost.aspx?PostID=6589
If anyone could educate me on how to do the same for the WPF version I would be grateful. Also, is there a comprehensive list of all events available in the WPF version? It would be nice to see what events exists and what information you are able to extract from them.
Thanks in advance.
Imported from legacy forums. Posted by Stefan (had 445 views)Xceed SupportMemberAugust 29, 2007 at 1:38 pmPost count: 5658
Effectively, there is no such thing as a ‘GroupingUpdated’ event in the DataGrid for WPF.
The list of events available for the DataGrid for WPF is available through the documentation topics and the class reference of the product.
As an additional note, please consider the “WPF” methodology for receiving change notification for a property whenever a CLR event is not provided. Here is how you can register a callback for whenever a DependencyProperty changes on an object:
DependencyPropertyDescriptor isBeingEdited =
DependencyPropertyDescriptor.FromProperty( Cell.IsBeingEditedProperty, typeof( Cell ) );
isBeingEdited.AddValueChanged( myCellInstance, new EventHandler( myHandler ) );
Concerning the ‘GroupingChanged’ issue. What I suggest is to register to the DataGridControl.Items.GroupDescriptions.CollectionChanged event to receive the notification you need.
Imported from legacy forums. Posted by Marcus [Xceed] (had 215 views)User (Old forums)MemberAugust 29, 2007 at 1:56 pmPost count: 23064
Thanks Marcus for the reply.
I actually solved it myself, with (for the time being):
((INotifyCollectionChanged)this.ordersGrid.GroupLevelDescriptions).CollectionChanged += new NotifyCollectionChangedEventHandler(this.GroupLevelDescriptionsCollectionChanged);
void GroupLevelDescriptionsCollectionChanged(object sender, EventArgs e)
List<string> lListGroupColumns = new List<string>();
foreach(GroupLevelDescription g in ((GroupLevelDescriptionCollection)sender))
foreach(Column c in ordersGrid.Columns)
c.Visible = !lListGroupColumns.Contains(c.FieldName);
A bit messy, but it works for now 🙂
I’ll be looking into the DataGridControl.Items.GroupDescriptions approach instead.
Imported from legacy forums. Posted by Stefan (had 3200 views)
- You must be logged in to reply to this topic.