Mercurial > silverbladetech
view SilverlightGlimpse/SilverFlow.Controls/Converters/BooleanToVisibilityConverter.cs @ 64:ba89e36631bc
Latest version
author | Steven Hollidge <stevenhollidge@hotmail.com> |
---|---|
date | Sun, 22 Apr 2012 14:20:52 +0100 |
parents | 536498832a79 |
children |
line wrap: on
line source
using System; using System.Windows; using System.Windows.Data; namespace SilverFlow.Controls.Converters { public class BooleanToVisibilityConverter : IValueConverter { /// <summary> /// Converts a boolean value to the display state of an element. /// </summary> /// <param name="value">The source data being passed to the target.</param> /// <param name="targetType">The <see cref="T:System.Type"/> of data expected by the target dependency property.</param> /// <param name="parameter">An optional parameter to be used in the converter logic.</param> /// <param name="culture">The culture of the conversion.</param> /// <returns> /// The value to be passed to the target dependency property. /// </returns> public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) { if (value == null) throw new ArgumentNullException("value"); return (bool)value ? Visibility.Visible : Visibility.Collapsed; } public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) { throw new NotImplementedException(); } } }