Click here to Skip to main content
14,360,812 members

Silverlight / WPF

 
Questionc# WPF MVVM accesing a view with from another view Pin
Member 1288059514-Jan-17 22:56
memberMember 1288059514-Jan-17 22:56 
AnswerRe: c# WPF MVVM accesing a view with from another view Pin
Pete O'Hanlon15-Jan-17 22:46
protectorPete O'Hanlon15-Jan-17 22:46 
GeneralRe: c# WPF MVVM accesing a view with from another view Pin
Member 1288059516-Jan-17 9:05
memberMember 1288059516-Jan-17 9:05 
AnswerRe: c# WPF MVVM accesing a view with from another view Pin
Richard Deeming16-Jan-17 3:26
mveRichard Deeming16-Jan-17 3:26 
GeneralRe: c# WPF MVVM accesing a view with from another view Pin
Member 1288059516-Jan-17 9:31
memberMember 1288059516-Jan-17 9:31 
GeneralRe: c# WPF MVVM accesing a view with from another view Pin
Richard Deeming16-Jan-17 10:12
mveRichard Deeming16-Jan-17 10:12 
GeneralRe: c# WPF MVVM accesing a view with from another view Pin
Member 1288059517-Jan-17 9:05
memberMember 1288059517-Jan-17 9:05 
GeneralRe: c# WPF MVVM accesing a view with from another view Pin
Richard Deeming17-Jan-17 9:40
mveRichard Deeming17-Jan-17 9:40 
That code makes no sense.

Firstly, when you create the new HomeViewModel, you're immediately trying to switch the view to the AddEditViewModel. Since you haven't created that viewmodel at this point, it's not going to work.
MainWindowViewModel.ctor 
⇒ HomeViewModel.ctor 
⇒ HomeViewModel.MwVm.set 
⇒ HomeViewModel.ViewChange 
⇒ MainWindowViewModel.DisplayAddEditView

Secondly, the MainWindowViewModel is not an ICommand. You can't use it as the Command property in the context menu.
Commanding Overview[^]
Introduction to WPF Commands[^]
Using WPF commands[^]
Implementing a custom WPF Command[^]

Take a step back and think about what you're trying to do.



"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer


GeneralRe: c# WPF MVVM accesing a view with from another view Pin
Member 1288059517-Jan-17 9:52
memberMember 1288059517-Jan-17 9:52 
QuestionBind To Static Property Pin
Kevin Marois13-Jan-17 6:32
professionalKevin Marois13-Jan-17 6:32 
AnswerRe: Bind To Static Property Pin
Richard Deeming13-Jan-17 6:55
mveRichard Deeming13-Jan-17 6:55 
GeneralRe: Bind To Static Property Pin
Kevin Marois13-Jan-17 7:01
professionalKevin Marois13-Jan-17 7:01 
GeneralRe: Bind To Static Property Pin
Richard Deeming13-Jan-17 8:49
mveRichard Deeming13-Jan-17 8:49 
GeneralRe: Bind To Static Property Pin
Kevin Marois13-Jan-17 8:56
professionalKevin Marois13-Jan-17 8:56 
GeneralRe: Bind To Static Property Pin
Richard Deeming13-Jan-17 9:18
mveRichard Deeming13-Jan-17 9:18 
GeneralRe: Bind To Static Property Pin
Kevin Marois13-Jan-17 9:23
professionalKevin Marois13-Jan-17 9:23 
GeneralRe: Bind To Static Property Pin
Richard Deeming13-Jan-17 9:24
mveRichard Deeming13-Jan-17 9:24 
GeneralRe: Bind To Static Property Pin
Kevin Marois13-Jan-17 9:25
professionalKevin Marois13-Jan-17 9:25 
GeneralRe: Bind To Static Property Pin
Richard Deeming13-Jan-17 9:29
mveRichard Deeming13-Jan-17 9:29 
GeneralRe: Bind To Static Property Pin
Kevin Marois13-Jan-17 9:31
professionalKevin Marois13-Jan-17 9:31 
QuestionWPF/MVVM - How To Make A Chess Board Pin
Kevin Marois20-Dec-16 7:13
professionalKevin Marois20-Dec-16 7:13 
AnswerRe: WPF/MVVM - How To Make A Chess Board Pin
Meshack Musundi26-Dec-16 20:26
professionalMeshack Musundi26-Dec-16 20:26 
QuestionMetroTabItem View Going out of Scope Pin
JPKI13-Dec-16 13:59
memberJPKI13-Dec-16 13:59 
AnswerRe: MetroTabItem View Going out of Scope Pin
Pete O'Hanlon13-Dec-16 21:50
protectorPete O'Hanlon13-Dec-16 21:50 
GeneralRe: MetroTabItem View Going out of Scope Pin
JPKI13-Dec-16 23:14
memberJPKI13-Dec-16 23:14 

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.