mirror of
https://github.com/digital-jellyfish/Virtu.git
synced 2024-11-30 05:49:48 +00:00
8382195feb
Added rudimentary UI to Silverlight and WPF platforms to enable disk selection at runtime. --HG-- extra : convert_revision : svn%3Affd33b8c-2492-42e0-bdc5-587b920b7d6d/trunk%4024459
42 lines
1.1 KiB
C#
42 lines
1.1 KiB
C#
using System;
|
|
using System.Globalization;
|
|
using System.Windows;
|
|
using System.Windows.Data;
|
|
|
|
namespace Jellyfish.Library
|
|
{
|
|
public sealed class StringFormatConverter : IValueConverter // SL is missing Binding.StringFormat
|
|
{
|
|
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
|
|
{
|
|
if (targetType != typeof(string))
|
|
{
|
|
return DependencyProperty.UnsetValue;
|
|
}
|
|
|
|
if (value == null)
|
|
{
|
|
return string.Empty;
|
|
}
|
|
|
|
string format = parameter as string;
|
|
if (!string.IsNullOrEmpty(format))
|
|
{
|
|
if (format.IndexOf('{') < 0)
|
|
{
|
|
format = "{0:" + format + "}";
|
|
}
|
|
|
|
return string.Format(culture, format, value);
|
|
}
|
|
|
|
return value.ToString();
|
|
}
|
|
|
|
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
|
|
{
|
|
return DependencyProperty.UnsetValue; // one way only
|
|
}
|
|
}
|
|
}
|