I have an issue with statechart. I created a state diagram and try to highlight the current active state by binding to a boolean variable.
In the xaml it is like this:
<TextBlock x:Name=“StateText” Text="{Binding Path=Data.Text}"
Foreground="{Binding Path=Data.IsActive, Converter={StaticResource ForegroundActiveECStateConverter}}"
In the cs code, I setup as:
public class State : GraphLinksModelNodeData
{
public bool IsActive
{
get { return _IsActive; }
set
{
if (_IsActive != value)
{
bool old = _IsActive;
_IsActive = value;
RaisePropertyChanged(“IsActive”, old, value);
}
}
}
private bool _IsActive = false;
}
and converter:
public class ForegroundActiveECStateConverter : Northwoods.GoXam.Converter
{
public override object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
{
Color f = Colors.Black;
if (value is bool)
{
if ((bool)value) f = Colors.Red;
}
return f;
}
}
However, when I try to run it, although value changes and converter is called, but the color never changes on state of statecharts. Can anyone help me on that? Thanks a lot.