1 //----------------------------------------------------------------
2 // Copyright (c) Microsoft Corporation. All rights reserved.
3 //----------------------------------------------------------------
4 namespace System.Activities.Presentation.Internal.PropertyEditing.Editors
7 using System.Windows.Data;
8 using System.Globalization;
10 using System.Activities.Presentation.Internal.PropertyEditing.FromExpression.Framework.PropertyInspector;
11 using System.Activities.Presentation;
14 // Converts an instance of NewItemFactoryTypeModel to its contained Type name.
16 internal class NewItemFactoryTypeModelToTypeNameConverter : IValueConverter
19 // Converts an instance of NewItemFactoryTypeModel to its corresponding type name
20 public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
23 if (typeof(string).IsAssignableFrom(targetType))
25 NewItemFactoryTypeModel model = value as NewItemFactoryTypeModel;
26 if (model != null && model.Type != null)
28 return model.Type.Name;
35 // This class is only a one-way converter
36 public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
38 throw FxTrace.Exception.AsError(new InvalidOperationException());