I have a situation where the grid will not allow me to set the activerow. Every attempt to set the active row results in a messagebox: Unable to update the row: Object reference not set to an instance of an object.
I am certain that I have set something incorrectly, but troubleshooting this is very difficult. I cannot determine why the grid will not accept the active row. The data is accurate in the grid.
The code below is only for test. It ensures main thread activity. The message appears twice, once when the activerow is being set and again during the call to base.OnMouseDown
_element =
this.DisplayLayout.UIElement.ElementFromPoint(new Point(e.X, e.Y));
currentRow.Selected =
true;
I will try, but it is going to take some time. The challenge is that the situation is not easily repeatable. I will put together a sample and see if I can find a sequence of events that reproduce the problem. It just so happens in my existing code that I have found such a sequence, but it requires clicking and expanding in a particular order. Once reproduced, it is easy to continue repeating the problem.
Would you be able to recreate the issue on a sample? You can also contact developer support or create a case to discuss the issue further.
I did actually see that in another post. We are not using background threads. This occurs in the onmousedownevent handler, which I added invoke code to ensure marshalling to the main thread.
Hi,
It's impossible to tell from just a code snippet. But if your application is using multiple threads, then that would be my first guess at what's causing the problem.
The grid and the DotNet BindingManager are not thread-safe. So it is extremely difficult, if not impossible, to use multiple threads and safely interact with bound controls.