Created
September 4, 2016 09:07
-
-
Save Rene-Sackers/49cc7daf92d0601c871a129e0dc299e6 to your computer and use it in GitHub Desktop.
A converter for use in XAML to convert a boolean to any true/false value.
This file contains 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 class BoolToAnyConverter : IValueConverter | |
{ | |
public object TrueValue { get; set; } | |
public object FalseValue { get; set; } | |
public object Convert(object value, Type targetType, object parameter, string language) | |
{ | |
return (bool)value ? TrueValue : FalseValue; | |
} | |
public object ConvertBack(object value, Type targetType, object parameter, string language) | |
{ | |
return value == TrueValue; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment