1 // -------------------------------------------------------------------
2 // Copyright (c) Microsoft Corporation. All Rights Reserved.
3 // -------------------------------------------------------------------
4 //From \\authoring\Sparkle\Source\1.0.1083.0\Common\Source\Framework\Data
5 namespace System.Activities.Presentation.Internal.PropertyEditing.FromExpression.Framework.Data
8 using System.ComponentModel;
9 using System.Globalization;
10 using System.Reflection;
12 using System.Windows.Controls;
13 using System.Windows.Data;
14 using System.Diagnostics.CodeAnalysis;
18 // Maps a bool to a FontWeight. True becomes Bold, and False is Normal.
21 [SuppressMessage("Microsoft.Performance", "CA1812:AvoidUninstantiatedInternalClasses")]
22 internal class BoolToDoubleConverter : IValueConverter
26 private double trueValue = 0;
27 private double falseValue = 0;
31 [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
32 public double TrueValue
36 return this.trueValue;
40 this.trueValue = value;
44 [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
45 public double FalseValue
49 return this.falseValue;
53 this.falseValue = value;
58 // IValueConverter Implementation
60 public object ConvertBack(object o, Type targetType, object parameter, CultureInfo culture)
62 Fx.Assert(false, "Never expecting the inverse transform to be called");
66 public object Convert(object o, Type targetType, object parameter, CultureInfo culture)
68 Fx.Assert(o is bool, "Ensure that transformed element is a boolean");
72 return this.trueValue;
76 return this.falseValue;