Hi,
We have a Xamgrid with several columns. First contains an "Edit" button.
We would like the following behavior :
case 1 - click on "normal" (text) cell : launch data loading
case 2 - click on "Edit" button :
a - launch data loading
b - switch to edit mode (not in the grid, this is some of our code)
In case 1, no problem as only one event is firered on row selection (ex : SelectedRowsCollectionChanged).
But in case 2, two events are fired :
- First the one for row selection,
- and then the button click
These two events are independent (not synchronized). So depending on how long takes first one to finish (loading some data), the second event can fire before the other one finish or not.
Is there a way for us to synchronize these events ?
By the way if during case 2, the focus is moved out of button, click event is not firered.....
Regards.Alain.
Hi Ekaterina,
Yesterday we found another solution :
Like this MouseLeftButtonDown is raised before any other event.
Anyway, thanks for all the time you guys spent to help us.
Regards.
Alain.
Hello,
I am just checking your progress on the issue.
If you require any further assistance please do not hesitate to ask.
Sincerely,
Ekaterina
Developer Support Engineer
Infragistics
www.infragistic.com/support
Hello Cosoluce_Stones,
I have been investigating into your issue, using your new sample that includes the BusyIndicator and the web service.
Since xamGrid is handling the events of its child objects, what happens is that when ActiveItem has being changed, the grid has handled the MouseLeftButtonDown event, but the buttons click event has not been raised yet. At that moment the BusyIndicator steals the focus and prevent the button from raising its click event.
What you can do in order to keep you custom logic is to:
1. Create a method PeformAction(), which is being called in the btnEditElement_Click handler AND in your VeiwModel class in the SleepingServiceCompleted’s body .
Or
2. Use other control that does not steals focus instead of the BusyIndicator.
If you explicitly call the btnEditElement_Click event, you will miss your event arguments, so extracting your functionality into a new method and calling it instead of explicitly call btnEditElement_Click event is preferable.
Please let me know if you need any further assistance regarding the discussed matter.
Infragistics, Inc.
www.infragistics.com/support
Another way to fix our problem would be to have the "button click" event firered before "row selection" event.
Is this possible ?Regards.
First thanks for your investigations.
In attachment, you will find a new solution.
Outputs will be like that :
* Output 1 - when 1rst element is selected (click on edit button, no busy indicator) : --- LoadData() : Start loading data --- LoadData() : End loading data --- Click : Click on edit button => Correct : Click happen after end loading data * Output 2 - when 2nd element is selected (click on edit button, no busy indicator) : --- LoadData() : Start loading data --- Click : Click on edit button --- webService.SleepingServiceAsync() return : 14:23:29.1689413 --- LoadData() : End loading data => Correct : Click happen before end loading data, because of asynchronous call to web service * Output 3 - when 3rd element is selected (click on edit button, WITH busy indicator) : --- LoadData() : Start loading data --- webService.SleepingServiceAsync() return : 14:23:38.3928779 --- LoadData() : End loading data => NOT correct : because BusyIndicator move focus out of button, no click event is raised
On question part A:
I agree with your explanation. If there is an asynchronous call in LoadData(), this method will finish just after call. Then Click event will be fired before asynchronous call will be completed.
I was not able to find a solution for that, but it is not the main problem.Il would prefer to fix "Question part B : fosus" instead.
On question part B:
As you can see in "Output 3", because of BusyIndicator, Click event is never raised.I know how to : - get actual control with focus - show busy indicator - hide busy indicator - restore focus to control
But click event is still not firered automatically and I cannot know that user made a click on the button.Do you know a solution for that ?
Thanks for your help.