Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Make sure you are setting the Binding Source correctly :</p> <pre><code>&lt;Window x:Class="WpfApplication1.MainWindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:WpfApplication1="clr-namespace:WpfApplication1" Title="MainWindow" Height="350" Width="525" Loaded="Window_Loaded_1" &gt; &lt;Grid&gt; &lt;TextBlock Text="{Binding XmlContentFile, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Window}}}" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Background="#FFF3A3A3"/&gt; &lt;/Grid&gt; </code></pre> <p> and make sure as well you are setting the value of your property in the right place :</p> <pre><code>public partial class MainWindow : Window,INotifyPropertyChanged { private string _xmlContentFile; public string XmlContentFile { get { return _xmlContentFile ; } set { _xmlContentFile = value; OnPropertyChanged("XmlContentFile"); } } public MainWindow() { InitializeComponent(); } private void Window_Loaded_1(object sender, RoutedEventArgs e) { XmlContentFile = "New Value !"; } public event PropertyChangedEventHandler PropertyChanged; protected virtual void OnPropertyChanged(string propertyName) { PropertyChangedEventHandler handler = PropertyChanged; if (handler != null) handler(this, new PropertyChangedEventArgs(propertyName)); } } </code></pre> <p>True that this answer is not in MVVM, but that won't need much changings except that you will be needing to set your DataContext to your ViewModel.</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. 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