I am trying to unit test the group fields behavior of my XamDataGrid.
I tried this:
FieldSortDescription sortDescription = new FieldSortDescription();sortDescription .FieldName = "FirstFieldName";sortDescription.IsGroupBy = true;
grid.FieldLayouts[0].SortedFields.Clear(); grid.FieldLayouts[0].SortedFields.Add(sortDescription);
Unfortunately, the event handler associated to the Grouped event of my grid is never called.
Does anybody have an idea of what is missing?
Thanks
Hello,
I have been looking into your issue and this behavior is expected since most event are only triggered by changes made through the UI. This is decided on since if a developer is performing some action he can also react to it in code and this also saves a ton of events from firing all the time which would drastically decrease performance.
If you were to describe what are you trying to use this for I might be able to suggest something more suitable.
Looking forward to hearing from you.
Sincerely,
Petar Monov
Developer Support Engineer
Infragistics Bulgaria
www.infragistics.com/support
I would like to test the binding between the Grouped event and my event handler and also the behavior of my event handler in a unit test.That's why I want to simulate this Grouped event.
Regards.
Hi,
If it is for testing purposes only why don't you call your event handler method explicitly in code?
Another thing you can use is Microsoft UI Automation which can simulate UI interaction.
Hope this helps.
Best regards Petar.
Of course I can explicitly call my event handler but I wanted also to test the data binding. So I will probably use Microsoft UI Automation.
I am just checking the progress of this issue and was wondering if you managed to achieve your goal or if you need any further assistance on the matter.
If the above suggestion helped you solve your issue please verify the thread as answered so other users may take better advantage of it.
Sincerely,Petar MonovDeveloper Support EngineerInfragistics Bulgariawww.infragistics.com/support
Thanks,
I hoped there would be another solution than using Microsoft UI Automation, but this solution fits for my issue.