using System;
using System.Linq;
using System.Collections.Generic;
using System.Text;
using System.Windows.Media;
using System.Collections.ObjectModel;
using System.Windows;
using System.Windows.Data;
using System.Globalization;
namespace CustomControlLibrary.Design
{
public class FontList : ObservableCollection<FontFamily>
{
public FontList()
{
foreach (FontFamily ff in Fonts.SystemFontFamilies)
{
Add(ff);
}
}
}
public class FontSizeList : ObservableCollection<double>
{
public FontSizeList()
{
Add(8);
Add(9);
Add(10);
Add(11);
Add(12);
Add(14);
Add(16);
Add(18);
Add(20);
}
}
public class FontStyleConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
FontStyle fs = (FontStyle)value;
return fs == FontStyles.Italic;
}
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
if (value != null)
{
bool isSet = (bool)value;
if (isSet)
{
return FontStyles.Italic;
}
}
return FontStyles.Normal;
}
}
public class FontWeightConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
FontWeight fs = (FontWeight)value;
return fs == FontWeights.Bold;
}
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
if (value != null)
{
bool isSet = (bool)value;
if (isSet)
{
return FontWeights.Bold;
}
}
return FontWeights.Normal;
}
}
}