26
|
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 } |