Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>You need to raise the <code>PropertyChangedEvent</code> for the property <code>LastTransmitted</code>, so that the UI gets notified that the property has changed and your Triggers are executed.</p> <p>Since you inherit your class from <code>ViewModelBase</code> I assume that the class implements <code>INotifyPropertyChanged</code> and provides a method to raise the event.</p> <pre><code>public bool LastTransmitted { get { return _tracker.lastTransmitted; } set { _tracker.lastTransmitted = value; RaisePropertyChanged("LastTransmitted"); } } </code></pre> <p><strong>UPDATE:</strong></p> <p>When i understand you right, you want that the Background of the <code>TextBlock</code> gets changed when the <code>LastTransmitted</code> property changes. TextBlock by itself has no Background-Property, so you have to put the TextBlock into an container like <code>Grid</code> or <code>StackPanel</code>.</p> <p>Here´s a DataTemplate for your ListBox that does what you want.</p> <pre><code>&lt;DataTemplate&gt; &lt;StackPanel&gt; &lt;StackPanel.Style&gt; &lt;Style TargetType="StackPanel"&gt; &lt;Style.Triggers&gt; &lt;DataTrigger Binding="{Binding Path=LastTransmitted}" Value="True"&gt; &lt;Setter Property="Background" Value="Green" /&gt; &lt;/DataTrigger&gt; &lt;DataTrigger Binding="{Binding Path=LastTransmitted}" Value="False"&gt; &lt;Setter Property="Background" Value="White" /&gt; &lt;/DataTrigger&gt; &lt;/Style.Triggers&gt; &lt;/Style&gt; &lt;/StackPanel.Style&gt; &lt;TextBlock HorizontalAlignment="Stretch" Text="{Binding Path=Description}" /&gt; &lt;/StackPanel&gt; &lt;/DataTemplate&gt; </code></pre>
    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.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. 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