Rev | Line | |
---|
[12503] | 1 | using System;
|
---|
| 2 | using System.Collections.Generic;
|
---|
| 3 | using System.Linq;
|
---|
| 4 | using System.Text;
|
---|
| 5 | using System.Windows.Data;
|
---|
| 6 | using System.Globalization;
|
---|
| 7 | using System.Windows.Media;
|
---|
| 8 |
|
---|
| 9 | namespace Microsoft.Research.DynamicDataDisplay.Converters
|
---|
| 10 | {
|
---|
| 11 | public sealed class BrushHSBConverter : IValueConverter
|
---|
| 12 | {
|
---|
| 13 | private double lightnessDelta = 1.0;
|
---|
| 14 | public double LightnessDelta
|
---|
| 15 | {
|
---|
| 16 | get { return lightnessDelta; }
|
---|
| 17 | set { lightnessDelta = value; }
|
---|
| 18 | }
|
---|
| 19 |
|
---|
| 20 | private double saturationDelta = 1.0;
|
---|
| 21 | public double SaturationDelta
|
---|
| 22 | {
|
---|
| 23 | get { return saturationDelta; }
|
---|
| 24 | set { saturationDelta = value; }
|
---|
| 25 | }
|
---|
| 26 |
|
---|
| 27 | #region IValueConverter Members
|
---|
| 28 |
|
---|
| 29 | public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
|
---|
| 30 | {
|
---|
| 31 | SolidColorBrush brush = value as SolidColorBrush;
|
---|
| 32 | if (brush != null)
|
---|
| 33 | {
|
---|
| 34 | SolidColorBrush result = brush.ChangeLightness(lightnessDelta).ChangeSaturation(saturationDelta);
|
---|
| 35 | return result;
|
---|
| 36 | }
|
---|
| 37 | else { return value; }
|
---|
| 38 | }
|
---|
| 39 |
|
---|
| 40 | public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
|
---|
| 41 | {
|
---|
| 42 | throw new NotImplementedException();
|
---|
| 43 | }
|
---|
| 44 |
|
---|
| 45 | #endregion
|
---|
| 46 | }
|
---|
| 47 | }
|
---|
Note: See
TracBrowser
for help on using the repository browser.