Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Check out <a href="http://msdn.microsoft.com/en-us/library/system.windows.controls.primitives.selector.selectionchanged.aspx" rel="nofollow noreferrer">SelectionChanged</a> event of the tab control.</p> <p><strong>EDIT: Changes to Question</strong></p> <p>You wish to cancel the event or cancel the save? </p> <p>For canceling the save, it's just a matter of asking the user something along these lines:</p> <pre><code>Dim msRes as MessageResult = MessageResult.No If mySwitchedFromTab.IsDirty Then msRes = msgbox("Save changes to previous tab?", YesNo, "MyApp") if msRes = MessageResult.Yes Then SaveMethod() End If End If </code></pre> <p>Now for canceling the TAB Change, then you've got to deal with booleans, and controlling if the functionality within the event handler will fire or not, and then setting the selected tab back to the previous tab, something along these lines:</p> <pre><code>If myGlobalTabFireBoolean Then Dim msRes as MessageResult = MessageResult.No If mySwitchedFromTab.IsDirty Then msRes = msgbox("Save changes to previous tab?", YesNoCancel, "MyApp") Select Case msRes Case MessageResult.Yes SaveMethod() Case MessageResult.Cancel myGlobalTabFireBoolean = False myTabContainer.SelectedItem = myPreviousTab Case Else ' Do Nothing End If End If Else myglobalTabFireBoolean = True End IF </code></pre> <p>Now these are not the only way to perform this type of functionality, as it depends personal coding style, and even such things as how you build your tab items (I build my tabitem's tabs a lot more detailed, so that I can override it's standard behavior, and make them act more like the tabs in Firefox and IE with the "X" button and the middle-mouse-button click to close).</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload