I have a some group data: Group1, Group2, ..., GroupN.
Image attached.
foreach (var plugin_ in Plugins)
{
var modelName = new TreeViewItemAdv
{
Header = plugin_.Key,
CollapsedImageSource = new BitmapImage(new Uri(@"Images/folder20.png", UriKind.Absolute)),
ExpandedImageSource = new BitmapImage(new Uri(@"Images/expanderFolder20.png", UriKind.Absolute)),
AllowDrop = false,
IsExpanded = true,
IsEditable = false
};
Item1.Items.Add(modelName);
var inputValues = new TreeViewItemAdv()
{
Header = "InputParameters",
CollapsedImageSource = new BitmapImage(new Uri(@"Images/folder20.png", UriKind.Absolute)),
ExpandedImageSource = new BitmapImage(new Uri(@"Images/expanderFolder20.png", UriKind.Absolute)),
Uid = "InputGroup",
AllowDrop = false,
IsExpanded = true,
IsEditable = false
};
modelName.Items.Add(inputValues);
foreach (var value in plugin_.Value.InputParameters)
{
var val = new TreeViewItemAdv()
{
Header = value.Description + " (" + value.Name + ")",
Name = value.Name,
LeftImageSource = new BitmapImage(new Uri(@"Images/Line_Chart.png", UriKind.Absolute)),
IsEditable = false,
AllowDrop = false,
Uid = "Curve",
IsExpanded = true
};
var bnd = new Binding("ImgConvert")
{
Source = ApplicationContext.Current.DataManager.Parameters,
Converter = new CurveDefinedToImageConverter(),
Path = new PropertyPath("IsDefined"),
Mode = BindingMode.OneWay,
ConverterParameter = "Curve"
};
val.SetBinding(TreeViewItemAdv.RightImageSourceProperty, bnd);
}
}
public class CurveDefinedToImageConverter : IValueConverter
{
public object Convert(object value, Type targetType,
object parameter, CultureInfo culture)
{
var loaded = (bool)value;
return new BitmapImage(new Uri(String.Format("/MLGeomechanics2;component/Images/{0}",
loaded ? "accept_button.png" : "error.png"), UriKind.RelativeOrAbsolute));
}
public object ConvertBack(object value, Type targetType,
object parameter, CultureInfo culture)
{
throw new NotImplementedException();
}
}
But when the parameter in code "IsDefined" changes, RightImage does not change in GUI.
Thanks.