~halega/+junk/sharpdevelop

« back to all changes in this revision

Viewing changes to src/AddIns/DisplayBindings/AvalonEdit.AddIn/Src/Options/Converters.cs

  • Committer: sk
  • Date: 2011-09-10 05:17:57 UTC
  • Revision ID: halega@halega.com-20110910051757-qfouz1llya9m6boy
4.1.0.7915 Release Candidate 1

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
 
2
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
 
3
 
 
4
using System;
 
5
using System.Globalization;
 
6
using System.Windows;
 
7
using System.Windows.Data;
 
8
 
 
9
namespace ICSharpCode.AvalonEdit.AddIn.Options
 
10
{
 
11
        sealed class BooleanToBoldConverter : IValueConverter
 
12
        {
 
13
                public static readonly BooleanToBoldConverter Instance = new BooleanToBoldConverter();
 
14
                
 
15
                public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
 
16
                {
 
17
                        if ((bool)value)
 
18
                                return FontWeights.Bold;
 
19
                        else
 
20
                                return FontWeights.Normal;
 
21
                }
 
22
                
 
23
                public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
 
24
                {
 
25
                        throw new NotSupportedException();
 
26
                }
 
27
        }
 
28
        
 
29
        sealed class BooleanToDefaultStringConverter : IValueConverter
 
30
        {
 
31
                public static readonly BooleanToDefaultStringConverter Instance = new BooleanToDefaultStringConverter();
 
32
                
 
33
                public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
 
34
                {
 
35
                        if ((bool)value)
 
36
                                return "(Default)";
 
37
                        else
 
38
                                return null;
 
39
                }
 
40
                
 
41
                public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
 
42
                {
 
43
                        throw new NotSupportedException();
 
44
                }
 
45
        }
 
46
}