Click here to Skip to main content
15,914,258 members
Home / Discussions / WPF
   

WPF

 
QuestionTooltip on DataGridTemplateColumn header [solved] Pin
Ravi Bhavnani11-Jan-12 6:01
professionalRavi Bhavnani11-Jan-12 6:01 
AnswerRe: Tooltip on DataGridTemplateColumn header Pin
Ravi Bhavnani11-Jan-12 6:10
professionalRavi Bhavnani11-Jan-12 6:10 
QuestionRIA Service not generating custom property Pin
Icarus12310-Jan-12 18:24
Icarus12310-Jan-12 18:24 
QuestionWPF Model From Hyperlink Pin
Kevin Marois10-Jan-12 10:50
professionalKevin Marois10-Jan-12 10:50 
GeneralRe: WPF Model From Hyperlink Pin
SledgeHammer0110-Jan-12 17:53
SledgeHammer0110-Jan-12 17:53 
GeneralRe: WPF Model From Hyperlink Pin
SledgeHammer0111-Jan-12 6:30
SledgeHammer0111-Jan-12 6:30 
AnswerRe: WPF Model From Hyperlink Pin
SledgeHammer0111-Jan-12 6:34
SledgeHammer0111-Jan-12 6:34 
QuestionWPF TabControl Events Pin
Tom Delany10-Jan-12 5:03
Tom Delany10-Jan-12 5:03 
This may be rather long. Please bear with me.

I am working on a WPF app. I am trying very hard to follow MVVM design practices as I understand them.

The MainWindow contains a TabControl. For each TabItem, I have created a separate UserControl in order to split things out logically and to make the XAML more manageable (there are going to be several tabs).

Each UserControl has its own ViewModel, which is instantiated in the code behind for the particular UserControl. Each UserControl/ViewModel pair is pretty much self-contained, independent of the others. There is a common Model for all of the above that handles the database end of things (each ViewModel talks to its own instance of the Model). The MainWindow does NOT have a MainWindowViewModel as I have found no need for it (all the MainWindow does is hold a text heading and the TabControl).

The thing that I am wrestling with is this: I would like to be able to prompt the end user to save any pending changes if they click into a different tab. Apparently, whenever you click on a different tab, the TabControl unloads the UserControl of the previously selected tab. The only event that seems to let me know that the user has clicked away into another tab is the Unloaded event for the UserControl. At that point, it appears to be too late to pop up a message from the User Control because it has, well, unloaded. Smile | :)

I discovered that I can handle the SelectionChanged event for the TabControl in the MainWindow, but the way my code is structured, there is no way to get back to the ViewModel of the tab that was deselected to make it save the changes from there.

Suggestions please... Blush | :O
WE ARE DYSLEXIC OF BORG. Refutance is systile. Your a$$ will be laminated.

There are 10 kinds of people in the world: People who know binary and people who don't.

GeneralRe: WPF TabControl Events Pin
Pete O'Hanlon10-Jan-12 9:57
mvePete O'Hanlon10-Jan-12 9:57 
GeneralRe: WPF TabControl Events Pin
Tom Delany10-Jan-12 10:15
Tom Delany10-Jan-12 10:15 
GeneralRe: WPF TabControl Events Pin
Pete O'Hanlon10-Jan-12 10:29
mvePete O'Hanlon10-Jan-12 10:29 
GeneralRe: WPF TabControl Events Pin
Tom Delany10-Jan-12 10:35
Tom Delany10-Jan-12 10:35 
GeneralRe: WPF TabControl Events Pin
Tom Delany10-Jan-12 10:17
Tom Delany10-Jan-12 10:17 
GeneralRe: WPF TabControl Events Pin
Pete O'Hanlon10-Jan-12 10:32
mvePete O'Hanlon10-Jan-12 10:32 
GeneralRe: WPF TabControl Events Pin
Tom Delany10-Jan-12 10:37
Tom Delany10-Jan-12 10:37 
GeneralRe: WPF TabControl Events Pin
Pete O'Hanlon10-Jan-12 10:38
mvePete O'Hanlon10-Jan-12 10:38 
GeneralRe: WPF TabControl Events [Edited] Pin
Tom Delany10-Jan-12 11:34
Tom Delany10-Jan-12 11:34 
GeneralRe: WPF TabControl Events [Edited] Pin
Mycroft Holmes10-Jan-12 13:11
professionalMycroft Holmes10-Jan-12 13:11 
GeneralRe: WPF TabControl Events Pin
Tom Delany10-Jan-12 14:08
Tom Delany10-Jan-12 14:08 
GeneralRe: WPF TabControl Events Pin
Tom Delany11-Jan-12 3:40
Tom Delany11-Jan-12 3:40 
GeneralRe: WPF TabControl Events Pin
Tom Delany12-Jan-12 7:53
Tom Delany12-Jan-12 7:53 
GeneralRe: WPF TabControl Events [Edited] Pin
Tom Delany11-Jan-12 8:32
Tom Delany11-Jan-12 8:32 
GeneralRe: WPF TabControl Events [Edited] Pin
Pete O'Hanlon11-Jan-12 8:46
mvePete O'Hanlon11-Jan-12 8:46 
GeneralRe: WPF TabControl Events [Edited] Pin
Tom Delany11-Jan-12 9:28
Tom Delany11-Jan-12 9:28 
GeneralRe: WPF TabControl Events [Edited] Pin
Pete O'Hanlon11-Jan-12 9:56
mvePete O'Hanlon11-Jan-12 9:56 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.