Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Try to use MVVM (Model-View-ViewModel) pattern.</p> <p>You need Model:</p> <pre><code>class Person { public string Name { get; set; } } </code></pre> <p>View is your window or UserControl.</p> <p>ViewModel can be something like that:</p> <pre><code>class PersonViewModel : INotifyPropertyChanged { private Person Model; public ViewModel(Person model) { this.Model = model; } public string Name { get { return Model.Name; } set { Model.Name = value; OnPropertyChanged("Name"); } } public event PropertyChangedEventHandler PropertyChanged; private void OnPropertyChanged(string propertyName) { var e = new PropertyChangedEventArgs(propertyName); PropertyChangedEventHandler changed = PropertyChanged; if (changed != null) changed(this, e); } } </code></pre> <p>Then you need to specify DataContext for your window:</p> <pre><code>View.DataContext = new PersonViewModel(somePerson); </code></pre> <p>And then define bindings in XAML:</p> <pre><code>&lt;UserControl x:Class="SomeApp.View" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Height="300" Width="300"&gt; &lt;Grid&gt; &lt;TextBlock Text="{Binding Name}" /&gt; &lt;Grid&gt; &lt;UserControl&gt; </code></pre> <p>MVVM makes code very elegant and easy.</p> <p>You can also try <a href="http://compositewpf.codeplex.com/" rel="noreferrer">PRISM</a> or Caliburn (<a href="http://caliburn.codeplex.com/" rel="noreferrer">http://caliburn.codeplex.com/</a>) frameworks but they are more complex.</p>
    singulars
    1. This table or related slice is empty.
    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. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      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