Hi all
i am creating WPF app which is based on MVVM model.
in my app i am using two different classes which have inherited by same parent class as bellow:
Public class CARVM : Viewmodel
{
//some properties
//Some methods
}
and
Public class BikeVM : Viewmodel
{
//some properties
//Some methods
}
and now i am assigning class CARVM as a datacontext of my XAML file.
Further process is as below :
1.calling one method of BikeVM from code behind(XAML.cs).
2.In method(BikeVM method) i am assigning a value to parent's class property(i.e Viewmodel's Property)
3. now i am binding this property to control in XAML class as below:
while debugging i am getting the new value of properety but in xaml it is not going to bind.
please help me out.
Thanks in advance.
Vishnujeet KumarPosted Jan 24, 2013, 9:56 AM
Sumit KumawatPosted Jan 24, 2013, 12:09 AM
i am uploading your given demo code with some modification.
the changes are as below :-
1.Model.cs is also inherited by BaseView.cs
2.I wrote one property in BaseView.cs
3.Model class has now contains SayHello() method instead of ViewModel class which we were using before.
4.MainWindow.xaml.cs method will call the SayHello() method.
5. In SayHello() method i am assigning the value to the BaseView.cs Class property which is binded to TextBlock.
Please take a look and let me know why the updated value is not going to bind with the TextBlock control.
Thanks in advance.
Sumit KumawatPosted Jan 23, 2013, 12:12 PM
Thanks for your reply.but my req. is diffrent.
i this demo code u added one model class. suppose that class is also is also inherited by Base view. and in SayHello() method i want to assign the value to model's class property.
thanx
Vishnujeet KumarPosted Jan 23, 2013, 10:18 AM