comparison Messaging/Server/Converters/ToggleButtonToTextConverter.cs @ 26:045dac571339

Working on data binding to a user control
author adminsh@apollo
date Wed, 21 Mar 2012 15:39:53 +0000
parents
children
comparison
equal deleted inserted replaced
25:81f9b72a44ce 26:045dac571339
1 using System;
2 using System.Windows.Data;
3 using System.Windows.Markup;
4
5 namespace Server.Converters
6 {
7 public class ToggleButtonToTextConverter : MarkupExtension, IValueConverter
8 {
9 private static ToggleButtonToTextConverter _toggleButtonToTextConverter = null;
10
11 public override object ProvideValue(IServiceProvider serviceProvider)
12 {
13 return _toggleButtonToTextConverter ?? (_toggleButtonToTextConverter = new ToggleButtonToTextConverter());
14 }
15
16 #region IValueConverter Members
17
18 public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
19 {
20 return (bool) value ? "ON" : "OFF";
21 }
22
23 public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
24 {
25 throw new NotImplementedException();
26 }
27
28 #endregion
29 }
30 }