Click here to Skip to main content
15,899,313 members

Comments by Member 11859517 (Top 110 by date)

Member 11859517 2-Dec-19 1:54am View    
thanks, I am using MVVM light. Here why I want to use code in code behind of main window,
what extactly i have to do is,
I my main window i have
<contentcontrol margin="10" grid.row="1" name="viewLoader" content="{Binding CurrentViewModel}">

In my mainViewModel i have property of type ViewModelBase
private ViewModelBase currentViewModel;
public ViewModelBase CurrentViewModel
{
get { return currentViewModel; }
set
{
currentViewModel = value;
RaisePropertyChanged(() => CurrentViewModel);
}
}
how to set this property from my FirstviewModel, i mean i want to assign FirstView to Content control
using mvvm
Member 11859517 2-Dec-19 0:01am View    
Thanks Ashutosh,

I have 3 user control with ViewModel,
but var FirstV = new FirstView(){DataContext = FirstViewModel}
is giving error that 'FirstViewModel' is a type which is not valid for given context,

but i guess this solution for if button on mainView, But my button on usercontrol, on that button click want to open on another user control on,
i m new to mvvm, Pls if u provide code block. it wolud help me
Member 11859517 31-Jul-18 10:01am View    
how to Retrieve value from the same dictionary
Member 11859517 28-Jun-18 9:09am View    
do you know hot to hide any div?
Member 11859517 27-Jun-18 10:57am View    
yes, That's what i am trying to do.