Combobox Binding on DataGrid Problem

Nov 15, 2008 at 11:33 PM
Can someone please explain to me (urgently) if this is a bug, or have I overlooked something.

I have been trying to bind a list of Linq items to a datagrid.  The datagrid uses template columns some of which have comboboxes in them.
I noticed lots of changes when I updated my Preview Toolkit to Ver 1; such as DataFieldBinding changing to Binding.   so it is possible I am getting this wrong.

Here is my window code...

<Window x:Class="DataGridTest.Window1"
    Title="Window1" Height="300" Width="300">
        <CollectionViewSource x:Key="VATStats" x:Name="VATStatsCollection" />
        <Button DockPanel.Dock="Bottom" Width="125" Height="25" Click="Button_Click">Submit Changes</Button>
        <dg:DataGrid Name="mygrid">
                <dg:DataGridTextColumn DataFieldBinding="{Binding citemid}" Header="Item ID" />
                <dg:DataGridTextColumn DataFieldBinding="{Binding cvatid}" Header="VAT ID" />
                <dg:DataGridTemplateColumn Header="Vat State">
                            <TextBlock Text="{Binding Path=vatstat.cvatname, Mode=OneWay}" />
                            <ComboBox ItemsSource="{Binding Source={StaticResource VATStats}}" SelectedValue="{Binding vatstat}" SelectedValuePath="." DisplayMemberPath="cvatname" />

In code I set the collection source, and the grid itemssource, plus I have a submit button.

If I revert back to the earlier version of the tooklit, I can change the combobox value in each row to a different value.

Using the current version (and changing DataFieldBinding to Binding), when I select a combo in one row, all other rows that I edit after opening the window get set to null.

Is this a bug?
Nov 15, 2008 at 11:46 PM
An update...

I have just tried changing my Combo Column to...

                <dg:DataGridComboBoxColumn Header="Vat State" ItemsSource="{Binding Source={StaticResource VATStats}}" SelectedValueBinding="{Binding vatstat}" DisplayMemberPath="cvatname" />

When I select a value in the combobox, every row in the grid displays the selected value.
As I scroll up and down in the grid, every row in the grid changes as the current row changes.

It is as if it is not binding to each individual row.

Mar 30, 2009 at 8:57 PM
This should be fixed in the March 2009 release.  The issue is relating to IsSynchronizedWithCurrentItem being set to true.