1 //----------------------------------------------------------------
2 // Copyright (c) Microsoft Corporation. All rights reserved.
3 //----------------------------------------------------------------
5 namespace System.Activities.Presentation.Converters
7 using System.Windows.Data;
8 using System.Globalization;
9 using System.Activities.Presentation.Model;
11 // This class is used to convert a ModelItem to the innerobject, when binding to whole objectin xaml.
12 // reverse conversion is not required beacuse ModelProperty.SetValue accepts object as is.
13 public class ModelToObjectValueConverter : IValueConverter
15 public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
17 object convertedValue = null;
20 if (value is ModelItem)
22 convertedValue = ((ModelItem)value).GetCurrentValue();
26 convertedValue = value;
29 return convertedValue;
32 public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)