周五喽
This commit is contained in:
26
Converts/DoubleToGridLength.cs
Normal file
26
Converts/DoubleToGridLength.cs
Normal file
@@ -0,0 +1,26 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using System.Windows.Data;
|
||||
|
||||
namespace GeekDesk.Converts
|
||||
{
|
||||
class DoubleToGridLength : IValueConverter
|
||||
{
|
||||
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
|
||||
{
|
||||
double val = double.Parse(value.ToString());
|
||||
return new GridLength(val);
|
||||
}
|
||||
|
||||
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
|
||||
{
|
||||
GridLength val = (GridLength)value;
|
||||
return double.Parse(val.ToString());
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user