Running Infragistics 10.1
I basically just want to be able to stop in the middle of a user selecting a node, check a modified flag, popup a prompt asking if they want to save with a Yes, No Cancel. When the Tree's SelectionChanged even fires, the code-behind calls an application controller interface to perform a request. Before it performs the request it checks a boolean flag that specifies if there are any modifications they will lose. I have it all working except cancel. When the modal dialog pops up, user clicks cancel, since the UI thread completed, I had code that would reselect the previously selected item and set the XamWebTreeItem.IsSelected back to true. But I then have this weird behavior where it appears that 2 nodes are selected until you hover over the aborted node and then it shows unselected. I tried clearing the trees collection, tried setting IsExpanded hoping it would cause node to be redrawn correctly, nope, didn't work. Tried adding item to Selected collection, nope same behavior.
I then figured, if there was a SelectionChanging event, I could test for the changes there, and abort. Since I don't see that event I was wondering if there is any other event I could use? Could I implement the MouseLeftButtonDown event? If so how could I detect there that the user is trying to select another node?
Sorry for the long winded post.. Just out of ideas. I can always just ditch the "Cancel" option for now and just go with Yes, No but was hoping maybe there was an easier way to abort node selection programmatically.
I don't think there is an easy way of doing this.
Using the mouse down would have the same issue as using the selected changed, accept you would also need to remember what node was previously selected.
Would you have a sample on how to recreate the invalid display? I would like to see it.
Reproducing this could be tricky. Its an XamWebOutlookBar with a treeview inside an OutlookBarGroup. When the XamWebTree's SelectionChanged event fires a Modal Popup (ChildWindow) displays asking yes, no or cancel. Since the UI thread has already completed and changed the selected node, we change it back by finding the node in the treeview, and setting its IsSelected to true (we already maintain previous selected node so we can change back). The result is like I mentioned, two selected nodes displaying until you hover past the aborted node it then disappears as if its not really selected.
I figured it was some sort of a refresh issue and tried all kind of stuff on the node. Like expanding and collapsing node, etc. Nothing worked though there probably is something I didn't try.
If I get any free time I'll try to reproduce the issue in a sample playground app so I can upload it.
Thanks for the prompt reply.