How do i wire up an event to the TabHeaderClose button on a XamTabControl, so that I can do a "Do you want to save" before the tab is closed.
The TabItemEx.Closing event is a bubble routed event so you can handle it on the TabItemEx or the xamTabControl by either adding a handler for this event in code or in xaml.
e.g. to handle this on the tabcontrol:
thanks, that works, but ... if I want to prompt the user.....
MessageBoxResult res = MessageBox.Show("Do you want to save changes to '" + tabItem.ItemName + "'",tabItem.ItemName,MessageBoxButton.YesNoCancel,MessageBoxImage.Question, MessageBoxResult.Cancel);
how to I cancel the tab closure ? setting Handled = true; doesnt appear to work ,
if (res == MessageBoxResult.Cancel){args.Handled = true;}