Note that there are some explanatory texts on larger screens.

plurals
  1. POWPF TextBlock Binding to DependencyProperty
    text
    copied!<p>I have what I believe to be about one of the most simple cases of attempting to bind a view to a dependencyproperty in the view model. It seems that the initial changes are reflected in the view but other changes to the DP do not update the view's TextBlock. I'm probably just missing something simple but I just can't see what it is. Please take a look...</p> <p>My XAML has a status bar on the bottom of the window. I want to bind to the DP "VRAStatus".</p> <pre><code> &lt;StatusBar x:Name="sbar" Grid.Column="0" Grid.Row="2" Grid.ColumnSpan="2" VerticalAlignment="Bottom" Background="LightBlue" Opacity="0.4" DockPanel.Dock="Bottom" &gt; &lt;StatusBarItem&gt; &lt;TextBlock x:Name="statusBar" Text="{Binding VRAStatus}" /&gt; &lt;/StatusBarItem&gt; &lt;StatusBarItem&gt; &lt;Separator Style="{StaticResource StatusBarSeparatorStyle}"/&gt; &lt;/StatusBarItem&gt; &lt;/StatusBar&gt; </code></pre> <p>My viewmodel has the DP defined:</p> <pre><code> public string VRAStatus { get { return (string)GetValue(VRAStatusProperty); } set { SetValue(VRAStatusProperty, value); } } // Using a DependencyProperty as the backing store for VRAStatus. public static readonly DependencyProperty VRAStatusProperty = DependencyProperty.Register("VRAStatus", typeof(string), typeof(PenskeRouteAssistViewModel),new PropertyMetadata(string.Empty)); </code></pre> <p>Then, in my code I set the DP:</p> <pre><code> VRAStatus = "Test Message..."; </code></pre> <p>Is there something obvious here that I am missing? In my constructor for the viewmodel I set the DP like this:</p> <pre><code> VRAStatus = "Ready"; </code></pre> <p>I never get the Test Message to display.</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