[corlib] Update ValueTuple implementation
[mono.git] / mcs / class / referencesource / System.Activities.Presentation / System.Activities.Presentation / System / Activities / Presentation / TypeNameConverter.cs
1 //----------------------------------------------------------------
2 // Copyright (c) Microsoft Corporation.  All rights reserved.
3 //----------------------------------------------------------------
4
5 namespace System.Activities.Presentation
6 {
7     using System.Activities.Presentation.Model;
8     using System.Globalization;
9     using System.Windows.Data;
10     using Microsoft.Activities.Presentation;
11
12     internal sealed class TypeNameConverter : IValueConverter
13     {
14         public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
15         {
16             Type type = value as Type;
17
18             if (type == null)
19             {
20                 ModelItem modelItem = value as ModelItem;
21                 if (modelItem != null)
22                 {
23                     type = modelItem.GetCurrentValue() as Type;
24                 }
25             }
26
27             bool fullName = bool.Parse(parameter.ToString());
28
29             return TypeNameHelper.GetDisplayName(type, fullName);
30         }
31
32         public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
33         {
34             throw FxTrace.Exception.AsError(new NotImplementedException());
35         }
36     }
37 }