Quantcast
Channel: Windows Presentation Foundation (WPF) forum
Viewing all articles
Browse latest Browse all 18858

how to bind textblock using MVVM in wpf?

$
0
0

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:

  <TextBlock Text="{Binding Test,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"/>

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.


sumitk


Viewing all articles
Browse latest Browse all 18858

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>