mirror of
https://github.com/holgerb83/ModernWpfPlayground.git
synced 2025-12-14 16:16:24 +01:00
initial commit
This commit is contained in:
20
PixelsToGridLengthConverter.cs
Normal file
20
PixelsToGridLengthConverter.cs
Normal file
@@ -0,0 +1,20 @@
|
||||
using System;
|
||||
using System.Globalization;
|
||||
using System.Windows;
|
||||
using System.Windows.Data;
|
||||
|
||||
namespace ModernWpfPlayground
|
||||
{
|
||||
public class PixelsToGridLengthConverter : IValueConverter
|
||||
{
|
||||
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
|
||||
{
|
||||
return value is double d ? new GridLength(d) : new GridLength(1.0, GridUnitType.Auto);
|
||||
}
|
||||
|
||||
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user