Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>It works fine by me. The only difference is DataContract tag removed and DataContext assigned. and My sample is following:</p> <pre><code>&lt;Window x:Class="_4206499.MainWindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Title="MainWindow" Height="360" Width="578"&gt; &lt;Grid&gt; &lt;TextBox Text="{Binding Path=Description, Mode=TwoWay}" VerticalAlignment="Center" Margin="12,12,286,278" /&gt; &lt;Button Width="100" Margin="57,59,346,219" Click="Button_Click"&gt;&lt;/Button&gt; &lt;/Grid&gt; </code></pre> <p></p> <p>and code behind is</p> <p><code><pre> using System; using System.Windows; using ClassLibrary1;</p> <p>namespace _4206499 { public partial class MainWindow : Window { public MainWindow() { InitializeComponent(); Source = new Source(); DataContext = Source; }</p> <pre><code> public Source Source { get; set;} private void Button_Click(object sender, RoutedEventArgs e) { Source.Description = DateTime.Now.ToString(); } } </code></pre> <p>} </pre></code></p> <p>and one from separate class library: <pre><code> using System; using System.ComponentModel;</p> <p>namespace ClassLibrary1 { public class Source : INotifyPropertyChanged { private String _Description;</p> <pre><code> public String Description { get { return _Description; } set { if (_Description == value) return; _Description = value; OnPropertyChanged("Description"); } } public event PropertyChangedEventHandler PropertyChanged; protected virtual void OnPropertyChanged(string propertyName) { PropertyChangedEventHandler handler = this.PropertyChanged; if (handler != null) { var e = new PropertyChangedEventArgs(propertyName); handler(this, e); } } } </code></pre> <p>}</p> <p></pre></code></p>
 

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