I have a grid control in a tabcontrol. I need to validate the grid when user attempts to leave the tab. If validation fails, I need to cancel the tab change (so to disallow user to change the tab until validation succeeds).
The problem with this approach is SelectionChanged event of my tab control fires many times due to children with SelectionChanged events. This makes validation 开发者_如何学Gomessage to appear again and again.
Also for canceling the tab change, I need to re-select the same tab within the SelectionChanged event which fires the event again.
Any ideas how I can get around this issue?
look here for how to prevent a tab from changing in the first place. in that delegate you can execute your validation logic
精彩评论