1234567891011121314151617181920212223242526272829303132333435363738394041424344454647 |
- namespace GDNXFD.Alert.Config.Converters
- {
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using System.Windows;
- using System.Windows.Data;
- /// <summary>
- /// Boolean to visibility converter.
- /// </summary>
- public class BooleanToVisibilityConverter : IValueConverter
- {
- /// <summary>
- /// Converts a boolean value to a visibility value.
- /// </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)
- {
- bool val = System.Convert.ToBoolean(value);
- if (val)
- {
- return Visibility.Visible;
- }
- return Visibility.Collapsed;
- }
- /// <summary>
- /// Not implemented.
- /// </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)
- {
- throw new NotImplementedException();
- }
- }
- }
|