Created
March 10, 2014 00:50
-
-
Save minacle/9457561 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Public NotInheritable Class MultiplexConverter | |
| Implements System.Windows.Data.IValueConverter | |
| Private _Converters As New System.Collections.ObjectModel.Collection(Of System.Windows.Data.IValueConverter) | |
| <System.ComponentModel.BindableAttribute(True)> | |
| Public ReadOnly Property Items As System.Collections.ObjectModel.Collection(Of System.Windows.Data.IValueConverter) | |
| Get | |
| Return _Converters | |
| End Get | |
| End Property | |
| Public Function Convert(value As Object, targetType As System.Type, parameter As Object, culture As System.Globalization.CultureInfo) As Object Implements System.Windows.Data.IValueConverter.Convert | |
| Dim ConvertedValue = value | |
| For Each Converter In _Converters | |
| ConvertedValue = Converter.Convert(ConvertedValue, targetType, parameter, culture) | |
| Next | |
| Return ConvertedValue | |
| End Function | |
| Public Function ConvertBack(value As Object, targetType As System.Type, parameter As Object, culture As System.Globalization.CultureInfo) As Object Implements System.Windows.Data.IValueConverter.ConvertBack | |
| Dim ConvertedValue = value | |
| For Each Converter In _Converters.Reverse | |
| ConvertedValue = Converter.ConvertBack(ConvertedValue, targetType, parameter, culture) | |
| Next | |
| Return ConvertedValue | |
| End Function | |
| End Class |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment