Click here to Skip to main content
15,512,244 members
Home / Discussions / WPF
   

WPF

 
Question[Problem] Why can not Pass Image between 2 Views by using the same ViewModel (MVVM) Pin
Oscar Tsai18-Jun-21 8:34
Oscar Tsai18-Jun-21 8:34 
AnswerRe: [Problem] Why can not Pass Image between 2 Views by using the same ViewModel (MVVM) Pin
Gerry Schmitz19-Jun-21 15:29
mveGerry Schmitz19-Jun-21 15:29 
GeneralRe: [Problem] Why can not Pass Image between 2 Views by using the same ViewModel (MVVM) Pin
Oscar Tsai20-Jun-21 4:20
Oscar Tsai20-Jun-21 4:20 
GeneralRe: [Problem] Why can not Pass Image between 2 Views by using the same ViewModel (MVVM) Pin
Gerry Schmitz20-Jun-21 7:01
mveGerry Schmitz20-Jun-21 7:01 
AnswerRe: [Problem] Why can not Pass Image between 2 Views by using the same ViewModel (MVVM) Pin
Richard Deeming21-Jun-21 0:37
mveRichard Deeming21-Jun-21 0:37 
GeneralRe: [Problem] Why can not Pass Image between 2 Views by using the same ViewModel (MVVM) Pin
Oscar Tsai21-Jun-21 5:10
Oscar Tsai21-Jun-21 5:10 
GeneralRe: [Problem] Why can not Pass Image between 2 Views by using the same ViewModel (MVVM) Pin
Oscar Tsai21-Jun-21 17:11
Oscar Tsai21-Jun-21 17:11 
AnswerRe: [Problem] Why can not Pass Image between 2 Views by using the same ViewModel (MVVM) Pin
michaelbarb23-Sep-21 11:32
michaelbarb23-Sep-21 11:32 
One thing I see right off the bat is that when you use DataContext you are instantiating DisplayViewModel.
XML
<Page.DataContext>
    <vm:DisplayViewModel/>
</Page.DataContext>

You basically created two instances of DisplayViewModel.
One fix would be to instantiate it somewhere else in C# :
C#
DisplayViewModel displayViewModel = new DisplayViewModel();

Then add to each page then for each page in C# on initialization add:
C#
this.DataContext = ????.displayViewModel

Now they will both point to the same instance.
So many years of programming I have forgotten more languages than I know.

GeneralRe: [Problem] Why can not Pass Image between 2 Views by using the same ViewModel (MVVM) Pin
Oscar Tsai13-Oct-21 16:14
Oscar Tsai13-Oct-21 16:14 
GeneralRe: [Problem] Why can not Pass Image between 2 Views by using the same ViewModel (MVVM) Pin
michaelbarb14-Oct-21 13:38
michaelbarb14-Oct-21 13:38 
QuestionProblem Setting Focus Pin
Kevin Marois24-May-21 10:39
professionalKevin Marois24-May-21 10:39 
AnswerRe: Problem Setting Focus Pin
Richard Deeming24-May-21 22:56
mveRichard Deeming24-May-21 22:56 
QuestionImpossible to override a value in an animation located in a style? Pin
Mc_Topaz20-May-21 7:51
Mc_Topaz20-May-21 7:51 
AnswerRe: Impossible to override a value in an animation located in a style? Pin
Gerry Schmitz20-May-21 9:08
mveGerry Schmitz20-May-21 9:08 
QuestionApp Security Behavior Pin
Kevin Marois20-May-21 7:09
professionalKevin Marois20-May-21 7:09 
QuestionOverride a value in base style's resource Pin
Mc_Topaz20-May-21 3:45
Mc_Topaz20-May-21 3:45 
AnswerRe: Override a value in base style's resource Pin
Richard Deeming20-May-21 5:33
mveRichard Deeming20-May-21 5:33 
GeneralRe: Override a value in base style's resource Pin
Mc_Topaz20-May-21 7:00
Mc_Topaz20-May-21 7:00 
QuestionApply TextBlock Captions at Runtime Pin
Kevin Marois14-May-21 10:34
professionalKevin Marois14-May-21 10:34 
AnswerRe: Apply TextBlock Captions at Runtime Pin
Peter_in_278014-May-21 14:36
professionalPeter_in_278014-May-21 14:36 
GeneralRe: Apply TextBlock Captions at Runtime Pin
Kevin Marois14-May-21 14:42
professionalKevin Marois14-May-21 14:42 
GeneralRe: Apply TextBlock Captions at Runtime Pin
Pete O'Hanlon15-May-21 0:51
mvaPete O'Hanlon15-May-21 0:51 
AnswerRe: Apply TextBlock Captions at Runtime Pin
Mycroft Holmes15-May-21 13:25
professionalMycroft Holmes15-May-21 13:25 
GeneralRe: Apply TextBlock Captions at Runtime Pin
Gerry Schmitz16-May-21 12:17
mveGerry Schmitz16-May-21 12:17 
QuestionWPF TextBox Handle Data Pasted In Pin
Kevin Marois14-Apr-21 9:29
professionalKevin Marois14-Apr-21 9:29 

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.