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.Windows;
|
---|
| 7 |
|
---|
| 8 | namespace Microsoft.Research.DynamicDataDisplay.Converters
|
---|
| 9 | {
|
---|
| 10 | public abstract class TwoValuesMultiConverter<T1, T2> : IMultiValueConverter
|
---|
| 11 | {
|
---|
| 12 | #region IMultiValueConverter Members
|
---|
| 13 |
|
---|
| 14 | public object Convert(object[] values, Type targetType, object parameter, System.Globalization.CultureInfo culture)
|
---|
| 15 | {
|
---|
| 16 | if (values != null && values.Length == 2)
|
---|
| 17 | {
|
---|
| 18 | if (values[0] is T1 && values[1] is T2)
|
---|
| 19 | {
|
---|
| 20 | T1 param1 = (T1)values[0];
|
---|
| 21 | T2 param2 = (T2)values[1];
|
---|
| 22 |
|
---|
| 23 | var result = ConvertCore(param1, param2, targetType, parameter, culture);
|
---|
| 24 | return result;
|
---|
| 25 | }
|
---|
| 26 | }
|
---|
| 27 |
|
---|
| 28 | return DependencyProperty.UnsetValue;
|
---|
| 29 | }
|
---|
| 30 |
|
---|
| 31 | protected abstract object ConvertCore(T1 value1, T2 value2, Type targetType, object parameter, System.Globalization.CultureInfo culture);
|
---|
| 32 |
|
---|
| 33 | public virtual object[] ConvertBack(object value, Type[] targetTypes, object parameter, System.Globalization.CultureInfo culture)
|
---|
| 34 | {
|
---|
| 35 | throw new NotSupportedException();
|
---|
| 36 | }
|
---|
| 37 |
|
---|
| 38 | #endregion
|
---|
| 39 | }
|
---|
| 40 | }
|
---|
Note: See
TracBrowser
for help on using the repository browser.