comparison SilverlightGlimpse/SilverFlow.Controls/Converters/BooleanToVisibilityConverter.cs @ 63:536498832a79

Latest version before changing bindings to Listbox
author Steven Hollidge <stevenhollidge@hotmail.com>
date Sun, 22 Apr 2012 13:33:42 +0100
parents
children
comparison
equal deleted inserted replaced
62:810116cd6b8e 63:536498832a79
1 using System;
2 using System.Windows;
3 using System.Windows.Data;
4
5 namespace SilverFlow.Controls.Converters
6 {
7 public class BooleanToVisibilityConverter : IValueConverter
8 {
9 /// <summary>
10 /// Converts a boolean value to the display state of an element.
11 /// </summary>
12 /// <param name="value">The source data being passed to the target.</param>
13 /// <param name="targetType">The <see cref="T:System.Type"/> of data expected by the target dependency property.</param>
14 /// <param name="parameter">An optional parameter to be used in the converter logic.</param>
15 /// <param name="culture">The culture of the conversion.</param>
16 /// <returns>
17 /// The value to be passed to the target dependency property.
18 /// </returns>
19 public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
20 {
21 if (value == null)
22 throw new ArgumentNullException("value");
23
24 return (bool)value ? Visibility.Visible : Visibility.Collapsed;
25 }
26
27 public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
28 {
29 throw new NotImplementedException();
30 }
31 }
32 }