Я пытаюсь сделать ячейку жирной или обычной, если элемент новый / старый внутри DataGrid, но наткнулся на ошибку ..
Похоже, моя проблема описана здесь: Почему я не могу связать Visiblitya DataGridTemplateColumn в Silverlight 4?
Я получаю следующую ошибку:
Объект типа 'System.Windows.Data.Binding' не может быть преобразован в тип 'System.Windows.FontWeight '.
И мой XAML выглядит так:
<sdk:DataGridTextColumn Header="Subject" Binding="{Binding Subject}" CanUserReorder="True" CanUserResize="True" CanUserSort="True" Width="Auto" FontWeight="{Binding IsNew, Converter={StaticResource BoolToFontWeightConverter}}" />
Мой вопрос, есть ли способ обойти это?Я даже не использую столбец шаблона, это текстовый столбец ..
public class BoolToFontWeightConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
return ((bool)value) ? FontWeights.Bold : FontWeights.Normal;
}
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
return (FontWeight)value == FontWeights.Bold;
}
}