Bug in DataGrid .NET Framework 4.0

Jan 11, 2013 at 11:13 AM

Today, I got a crazy behaviour. My multibinding works on one machine but on another I got DependencyProperty.UnsetValue. 

Machine 1:

Win8 works fine

Machine 2:

Win7 got DependencyProperty.UnsetValue

Here is my XAML:

 <StackPanel Margin="10" Orientation="Horizontal">
            <TextBlock VerticalAlignment="Center" Margin="10" Text="Steuer: " />
            <ComboBox Name="ComboSteuer" ItemsSource="{Binding Steuern}" SelectedIndex="0" HorizontalContentAlignment="Stretch"  Width="100" Margin="10" />
            ItemsSource="{Binding Books}"
                <DataGridTextColumn Header="Title" Binding="{Binding Title}" Width="*" />
                <DataGridTextColumn Header="Autor" Binding="{Binding Author}" Width="*" />
                <DataGridTextColumn Header="Netto" Binding="{Binding NetPrice, StringFormat=' {0} €'}" Width="Auto" />
                <DataGridTextColumn Header="Steuer">
                        <MultiBinding StringFormat=' {0:f} €' Converter="{multiDataBindingSample:SteuerConverter}">
                            <Binding ElementName="ComboSteuer" Path="SelectedValue" />
                            <Binding Path="NetPrice" />

And my converer for the MultiBinding looks:

 public class SteuerConverter : MarkupExtension, IMultiValueConverter
        private SteuerConverter _bruttoConverter;

        public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture)
            double steuer =0;
            if (Double.TryParse(values[0].ToString(), out steuer))
                double netto = Double.Parse(values[1].ToString());

                return netto/100*steuer;

            return values[1];

        public object[] ConvertBack(object value, Type[] targetTypes, object parameter, CultureInfo culture)
            return default(object[]);

        public override object ProvideValue(IServiceProvider serviceProvider)
            return _bruttoConverter ?? (_bruttoConverter = new SteuerConverter());

I know the could could be nicer ;-)

Machine 2 with Win7

Machine 1 with Win8

Framework is 4.0 on Win7 and on Win8 is 4.5 installed. It looks that in 4.0 ElementBinding ist not allowed in a DataGridtextColumn only in .NET 4.5 it works perfectly. Is there a change or is it really a bug? I don`t find any information on this change.

Kind Regards,