Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>You need to implement the <code>INotifyPropertyChanged</code> on the class. Here is the Example:</p> <pre><code>public class Person : INotifyPropertyChanged { //public int Id //{ get; set; } //public string Name { get; set; } private int _Id; public int Id { get { return _Id; } set { _Id = value; RaisePropertyChanged("Id"); } } private string _EmpNo { get { return Id.ToString() + Name.ToString(); } } private string _Name; public string Name { get { return _Name; } set { _Name = value; RaisePropertyChanged("Name"); } } private void RaisePropertyChanged(string property) { if (PropertyChanged != null) PropertyChanged(this, new PropertyChangedEventArgs(property)); } public event PropertyChangedEventHandler PropertyChanged; } </code></pre> <p>XAML code:</p> <pre><code>&lt;DockPanel&gt; &lt;TextBox Text="{Binding P1.Id}" Height="50" Width="100" DockPanel.Dock="Top" /&gt; &lt;TextBox Text="{Binding P1.Name}" Height="50" Width="100" DockPanel.Dock="Top" /&gt; &lt;Button Content="OK" Click="Button_Click" DockPanel.Dock="Bottom"/&gt; &lt;/DockPanel&gt; </code></pre> <p>Test:</p> <pre><code>public TestWindow() { InitializeComponent(); this.DataContext = this; } private Person _P1 = new Person(); public Person P1 { get { return _P1; } set { _P1 = value; } } private void Button_Click(object sender, RoutedEventArgs e) { } </code></pre> <p>type something in the 2 textboxes..and on the Button click see the value of the person P1 ..u will find the calculated field with the value.. hope it helps u.. Thanks, BHavik</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload