123456789101112131415161718192021222324252627282930313233343536373839404142434445464748 |
- namespace GDNXFD.Alert.Config.Converters
- {
- using System;
- using System.Windows;
- using System.Windows.Data;
- /// <summary>
- /// enum to bool converter
- /// </summary>
- public class BooleanToRadioButtonConverter : IValueConverter
- {
- /// <summary>
- /// Convert a travel type to bool.
- /// </summary>
- /// <param name="value"></param>
- /// <param name="targetType"></param>
- /// <param name="parameter"></param>
- /// <param name="culture"></param>
- /// <returns></returns>
- public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
- {
- if (value is bool)
- {
- return !(bool)value;
- }
- return value;
- }
- /// <summary>
- /// Convert back
- /// </summary>
- /// <param name="value"></param>
- /// <param name="targetType"></param>
- /// <param name="parameter"></param>
- /// <param name="culture"></param>
- /// <returns></returns>
- public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
- {
- if (value is bool)
- {
- return !(bool)value;
- }
- return value;
- }
- }
- }
|