annotate Messaging/Server/Converters/ToggleButtonToTextConverter.cs @ 65:5d0c5cc83a7a

Click event handler added
author Steven Hollidge <stevenhollidge@hotmail.com>
date Sun, 22 Apr 2012 14:21:33 +0100
parents 045dac571339
children
rev   line source
26
045dac571339 Working on data binding to a user control
adminsh@apollo
parents:
diff changeset
1 using System;
045dac571339 Working on data binding to a user control
adminsh@apollo
parents:
diff changeset
2 using System.Windows.Data;
045dac571339 Working on data binding to a user control
adminsh@apollo
parents:
diff changeset
3 using System.Windows.Markup;
045dac571339 Working on data binding to a user control
adminsh@apollo
parents:
diff changeset
4
045dac571339 Working on data binding to a user control
adminsh@apollo
parents:
diff changeset
5 namespace Server.Converters
045dac571339 Working on data binding to a user control
adminsh@apollo
parents:
diff changeset
6 {
045dac571339 Working on data binding to a user control
adminsh@apollo
parents:
diff changeset
7 public class ToggleButtonToTextConverter : MarkupExtension, IValueConverter
045dac571339 Working on data binding to a user control
adminsh@apollo
parents:
diff changeset
8 {
045dac571339 Working on data binding to a user control
adminsh@apollo
parents:
diff changeset
9 private static ToggleButtonToTextConverter _toggleButtonToTextConverter = null;
045dac571339 Working on data binding to a user control
adminsh@apollo
parents:
diff changeset
10
045dac571339 Working on data binding to a user control
adminsh@apollo
parents:
diff changeset
11 public override object ProvideValue(IServiceProvider serviceProvider)
045dac571339 Working on data binding to a user control
adminsh@apollo
parents:
diff changeset
12 {
045dac571339 Working on data binding to a user control
adminsh@apollo
parents:
diff changeset
13 return _toggleButtonToTextConverter ?? (_toggleButtonToTextConverter = new ToggleButtonToTextConverter());
045dac571339 Working on data binding to a user control
adminsh@apollo
parents:
diff changeset
14 }
045dac571339 Working on data binding to a user control
adminsh@apollo
parents:
diff changeset
15
045dac571339 Working on data binding to a user control
adminsh@apollo
parents:
diff changeset
16 #region IValueConverter Members
045dac571339 Working on data binding to a user control
adminsh@apollo
parents:
diff changeset
17
045dac571339 Working on data binding to a user control
adminsh@apollo
parents:
diff changeset
18 public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
045dac571339 Working on data binding to a user control
adminsh@apollo
parents:
diff changeset
19 {
045dac571339 Working on data binding to a user control
adminsh@apollo
parents:
diff changeset
20 return (bool) value ? "ON" : "OFF";
045dac571339 Working on data binding to a user control
adminsh@apollo
parents:
diff changeset
21 }
045dac571339 Working on data binding to a user control
adminsh@apollo
parents:
diff changeset
22
045dac571339 Working on data binding to a user control
adminsh@apollo
parents:
diff changeset
23 public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
045dac571339 Working on data binding to a user control
adminsh@apollo
parents:
diff changeset
24 {
045dac571339 Working on data binding to a user control
adminsh@apollo
parents:
diff changeset
25 throw new NotImplementedException();
045dac571339 Working on data binding to a user control
adminsh@apollo
parents:
diff changeset
26 }
045dac571339 Working on data binding to a user control
adminsh@apollo
parents:
diff changeset
27
045dac571339 Working on data binding to a user control
adminsh@apollo
parents:
diff changeset
28 #endregion
045dac571339 Working on data binding to a user control
adminsh@apollo
parents:
diff changeset
29 }
045dac571339 Working on data binding to a user control
adminsh@apollo
parents:
diff changeset
30 }