Good Day,
I have a TextBlock element with a black background and text with a black foreground color. I do not want my users to see the text until a task is completed. Then the text will turn into a greenish color.
My style trigger in xaml looks like:
<Style x:Key="DataImportCompletedStyle" TargetType="{x:Type TextBlock}">
<Setter Property="Foreground" Value="#FF000000" />
<Style.Triggers>
<DataTrigger Binding="{Binding IsImportCompleted}" Value="True">
<Setter Property="Foreground" Value="#FF99F999" />
</DataTrigger>
</Style.Triggers>
</Style>
My TextBlock looks like:
<TextBlock x:Name="ImportStatusMesage"
Grid.Row="3"
Margin="5,0,5,10"
Background="Black"
FontSize="18"
Foreground="#FF000000"
Style="{StaticResource DataImportCompletedStyle}"
Text="Data Import Completed" />
And my code behind for the IsImportCompleted boolean property is:
private bool isImportCompleted;
public bool IsImportCompleted
{
get { return isImportCompleted; }
set
{
isImportCompleted = value;
System.Diagnostics.Debug.WriteLine("Import Process Completed...OnPropertyChanged");
OnPropertyChanged("IsImportCompleted");
}
}
which does implement INotifyPropertyChanged. The task works fine and updates the IsImportCompleted property as I am seeing my message in the Output window, but the text doesn't change color.
I thought by using INotifyProperty that the UI would update itself.
I'm using Snoop and verified that the IsImportCompleted is set to true. But still no text color change.
Any advice,
TIA,
coson