Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
2320
SelectionChanging and abort selection
posted

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.