1 //----------------------------------------------------------------
2 // Copyright (c) Microsoft Corporation. All rights reserved.
3 //----------------------------------------------------------------
4 namespace System.Activities.Presentation.Internal.PropertyEditing.Editors
7 using System.Diagnostics;
8 using System.Diagnostics.CodeAnalysis;
9 using System.Globalization;
10 using System.Windows.Data;
12 using System.Activities.Presentation;
15 // A converter that takes a value of a property and a boolean indicating whether it
16 // is being edited and returns a string to use for the editor tool tip.
17 // This class gets instantiated from XAML.
19 [SuppressMessage("Microsoft.Performance", "CA1812:AvoidUninstantiatedInternalClasses")]
20 internal class ValueToToolTipConverter : IMultiValueConverter
22 public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture) {
23 Fx.Assert(values != null && values.Length == 2, "Invalid values passed into ValueToToolTipConverter");
25 bool isEditing = (bool)values[1];
26 string value = isEditing ? null : EditorUtilities.GetDisplayName(values[0]);
28 return string.IsNullOrEmpty(value) ? null : value;
31 public object[] ConvertBack(object value, Type[] targetTypes, object parameter, CultureInfo culture) {
32 throw FxTrace.Exception.AsError(new NotImplementedException());