source: trunk/CrypPlugins/MD5/Presentation/Converters/HighlightIndexToBrushConverter.cs @ 1488

Last change on this file since 1488 was 1488, checked in by pretzsch, 11 years ago

MD5 visualization: Fixed and improved presentation of parsed data block integers

File size: 944 bytes
Line 
1using System;
2using System.Collections.Generic;
3using System.Globalization;
4using System.Linq;
5using System.Text;
6using System.Windows.Data;
7using System.Windows.Media;
8
9namespace Cryptool.Plugins.MD5.Presentation.Converters
10{
11    public class HighlightIndexToBrushConverter : IValueConverter
12    {
13        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
14        {
15            if (value == null || parameter == null || !(value is int) || (!(parameter is string)))
16                return null;
17
18            int selectedIndex = (int)value;
19            int referenceIndex = System.Convert.ToInt32((string)parameter);
20
21            return selectedIndex == referenceIndex ? Brushes.Yellow : Brushes.White;
22        }
23
24        public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
25        {
26            return null;
27        }
28    }
29}
Note: See TracBrowser for help on using the repository browser.