Last change
on this file since 13398 was
12762,
checked in by aballeit, 9 years ago
|
#2283 GUI updates, Tree-chart, MCTS Version 2 (prune leaves)
|
File size:
1.1 KB
|
Line | |
---|
1 | using System;
|
---|
2 | using System.Collections.Generic;
|
---|
3 | using System.Linq;
|
---|
4 | using System.Text;
|
---|
5 | using System.Windows.Data;
|
---|
6 | using System.Globalization;
|
---|
7 |
|
---|
8 | namespace WpfTestSvgSample
|
---|
9 | {
|
---|
10 | /// <summary>
|
---|
11 | /// Used in MainWindow.xaml to converts a scale value to a percentage.
|
---|
12 | /// It is used to display the 50%, 100%, etc that appears underneath the zoom and pan control.
|
---|
13 | /// </summary>
|
---|
14 | public class ScaleToPercentConverter : IValueConverter
|
---|
15 | {
|
---|
16 | /// <summary>
|
---|
17 | /// Convert a fraction to a percentage.
|
---|
18 | /// <returns></returns>
|
---|
19 | public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
|
---|
20 | {
|
---|
21 | // Round to an integer value whilst converting.
|
---|
22 | return (double)(int)((double)value * 100.0);
|
---|
23 | }
|
---|
24 |
|
---|
25 | /// <summary>
|
---|
26 | /// Convert a percentage back to a fraction.
|
---|
27 | /// <returns></returns>
|
---|
28 | public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
|
---|
29 | {
|
---|
30 | return (double)value / 100.0;
|
---|
31 | }
|
---|
32 | }
|
---|
33 | }
|
---|
Note: See
TracBrowser
for help on using the repository browser.