1 //----------------------------------------------------------------
2 // Copyright (c) Microsoft Corporation. All rights reserved.
3 //----------------------------------------------------------------
4 namespace System.Activities.Presentation.Internal.PropertyEditing.Editors
8 using System.Collections;
9 using System.Diagnostics;
10 using System.Diagnostics.CodeAnalysis;
11 using System.Globalization;
12 using System.Windows.Data;
14 using System.Activities.Presentation.Internal.PropertyEditing.Model;
15 using System.Activities.Presentation.Internal.PropertyEditing.Resources;
16 using System.Activities.Presentation.PropertyEditing;
17 using System.Activities.Presentation;
21 // Checks the property entry and converts it
22 // to appropriate FlowDirection value which is returned back.
24 [SuppressMessage("Microsoft.Performance", "CA1812:AvoidUninstantiatedInternalClasses")]
25 internal class RTLValueConveter : IMultiValueConverter
27 public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture) {
28 FlowDirection returnValue = FlowDirection.LeftToRight;
29 Fx.Assert(values.Length == 3, "Incorrect values in the MultiValueConverter!");
30 if (values.Length == 3)
32 ModelPropertyEntry propertyEntry = values[1] as ModelPropertyEntry;
33 if (propertyEntry != null)
35 if (!propertyEntry.DisplayName.Equals("Name"))
37 if (targetType == typeof(FlowDirection))
39 object propertyValue = values[0];
40 if (propertyValue == null || propertyValue.GetType() == typeof(string))
42 //customize it to controls FlowDirection Property
43 returnValue = (FlowDirection)PropertyInspectorResources.GetResources()["SelectedControlFlowDirectionRTL"];
53 public object[] ConvertBack(object value, Type[] targetTypes, object parameter, CultureInfo culture) {
54 throw FxTrace.Exception.AsError(new NotImplementedException());