[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 FourValuesMultiConverter<T1, T2, T3, T4> : 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 == 4)
|
---|
| 17 | {
|
---|
| 18 | if (values[0] is T1 && values[1] is T2 && values[2] is T3 && values[3] is T4)
|
---|
| 19 | {
|
---|
| 20 | T1 param1 = (T1)values[0];
|
---|
| 21 | T2 param2 = (T2)values[1];
|
---|
| 22 | T3 param3 = (T3)values[2];
|
---|
| 23 | T4 param4 = (T4)values[3];
|
---|
| 24 |
|
---|
| 25 | var result = ConvertCore(param1, param2, param3, param4, targetType, parameter, culture);
|
---|
| 26 | return result;
|
---|
| 27 | }
|
---|
| 28 | }
|
---|
| 29 | return DependencyProperty.UnsetValue;
|
---|
| 30 | }
|
---|
| 31 |
|
---|
| 32 | protected abstract object ConvertCore(T1 value1, T2 value2, T3 value3, T4 value4, Type targetType, object parameter, System.Globalization.CultureInfo culture);
|
---|
| 33 |
|
---|
| 34 | public virtual object[] ConvertBack(object value, Type[] targetTypes, object parameter, System.Globalization.CultureInfo culture)
|
---|
| 35 | {
|
---|
| 36 | throw new NotSupportedException();
|
---|
| 37 | }
|
---|
| 38 |
|
---|
| 39 | #endregion
|
---|
| 40 | }
|
---|
| 41 | }
|
---|