Note that there are some explanatory texts on larger screens.

plurals
  1. POUpdate a label from datacontext
    primarykey
    data
    text
    <p><strong>MyView.xaml</strong></p> <pre><code>&lt;UserControl x:Class="CCTrayHelperWPF.View.StatusView" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" mc:Ignorable="d" d:DesignHeight="30" d:DesignWidth="1200"&gt; &lt;Grid &gt; &lt;Label Content="{Binding Message}"&gt; &lt;/Label&gt; &lt;/Grid&gt; </code></pre> <p></p> <p><strong>StatusViewModel .cs</strong></p> <pre><code> public class StatusViewModel : ViewModelBase --&gt; this class has inherited INotifyPropertyChanged { ObservableCollection&lt;Status&gt; _statusData; public StatusViewModel() { this._statusData = new ObservableCollection&lt;Status&gt;(); } public ObservableCollection&lt;Status&gt; ProjectStatus { get { return _statusData; } } } </code></pre> <p><strong>Status.cs</strong></p> <pre><code>public class Status : ViewModelBase { private string _message; public string Message { get { return _message; } set { if (_message == value) return; _message = value; OnPropertyChanged("Message"); } } } </code></pre> <p>In main window where I intergrated the view usercontrol giving the dataContext</p> <p><strong>MainWindow.xaml.cs</strong></p> <pre><code> if (!DesignerProperties.GetIsInDesignMode(this)) { StatusViewModel statusModel = new StatusViewModel(controller); this.StatusView.DataContext = statusModel; } </code></pre> <p>Now my question is: Why am I seein this binding error? Error is: <code>BindingExpression path error: 'Message' property not found on 'object' ''StatusViewModel' (HashCode=44528608)'. BindingExpression:Path=Message; DataItem='StatusViewModel' (HashCode=44528608); target element is 'Label' (Name=''); target property is 'Content' (type 'Object')</code></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.
 

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