I use Silverlight 3, Windows 2003 Server for hosting, RadControls Q1 2010.
I have 5 ComboBox en 3 data columns in a GridView:
<grid:RadGridView x:Name="RadGridView1" local:GridViewCommandRow.IsEnabled="true" CanUserDeleteRows="True" CanUserInsertRows="True" AutoGenerateColumns="False">
<grid:RadGridView.Columns>
<grid:GridViewComboBoxColumn x:Name="TransactieMethodesCBC" DisplayIndex="0" Header="Transactiemethodes" DataMemberBinding="{Binding Omschrijving, Mode=OneWay}" DisplayMemberPath="Omschrijving" SelectedValueMemberPath="Omschrijving" />
<grid:GridViewComboBoxColumn x:Name="PeriodesCBC" DisplayIndex="1" Header="Periodes" DataMemberBinding="{Binding Omschrijving, Mode=OneWay}" DisplayMemberPath="Omschrijving" SelectedValueMemberPath="Omschrijving" />
<grid:GridViewDataColumn Header="Eerste datum" DisplayIndex="2" DataMemberBinding="{Binding Eerste_datum, Mode=TwoWay}" />
<grid:GridViewDataColumn Header="Frequentie" DisplayIndex="3" DataMemberBinding="{Binding Frequentie, Mode=TwoWay}" />
<grid:GridViewComboBoxColumn x:Name="TermijnenCBC" DisplayIndex="4" Header="Termijnen" DataMemberBinding="{Binding Eenheid, Mode=OneWay}" DisplayMemberPath="Eenheid" SelectedValueMemberPath="Eenheid" />
<grid:GridViewComboBoxColumn x:Name="VerplichtingenCBC" DisplayIndex="5" Header="Verplichtingen" DataMemberBinding="{Binding Omschrijving, Mode=OneWay}" DisplayMemberPath="Omschrijving" SelectedValueMemberPath="Omschrijving" />
<grid:GridViewDataColumn Header="Bedragen" DisplayIndex="6" DataMemberBinding="{Binding Bedragen, Mode=TwoWay}" />
<grid:GridViewComboBoxColumn x:Name="RekeningmutatiesCBC" DisplayIndex="7" Header="Rekeningmutaties" DataMemberBinding="{Binding Omschrijving, Mode=OneWay}" DisplayMemberPath="Omschrijving" SelectedValueMemberPath="Omschrijving" />
<grid:GridViewDataColumn Header="Omschrijvingen" DisplayIndex="8" DataMemberBinding="{Binding Omschrijvingen, Mode=TwoWay}" />
</grid:RadGridView.Columns>
</grid:RadGridView>
Binding the itemsource to the ComboBoxColumn is done like:
((GridViewComboBoxColumn)this.RadGridView1.Columns[0]).ItemsSource = App.MijnTransactieMethodes;
((GridViewComboBoxColumn)this.RadGridView1.Columns[1]).ItemsSource = App.MijnPeriodes;
((GridViewComboBoxColumn)this.RadGridView1.Columns[4]).ItemsSource = App.MijnTransactieEenheden;
((GridViewComboBoxColumn)this.RadGridView1.Columns[5]).ItemsSource = App.MijnVerplichtingen;
((GridViewComboBoxColumn)this.RadGridView1.Columns[7]).ItemsSource = App.MijnRekeningMutaties;
Binding the other (Data) columns to itemsource is done like:
this.RadGridView1.ItemsSource = App.FinancieleVerplichtingenGridView;
Problems:
-ComboBoxes are filled with items but there is no default value. ComboBox initially stays empty!
-The selected item is only shown when the ComboBoxCell has focus, when focus is lost cell is empty again!
Question: Can I bind a ComboBoxColumn, for the display list, to an ItemsSource AND also to the GridView ItemsSource (Double Bind)? In a way that I have a list in the ComboBoxes and that the selected value is transferred by TwoWay binding to the GridView ItemsSource?
Kind regards,
Johan van der Galien.