Reputation: 3157
I have 2 silverlight controls on a form; datagrid which is bound to list of items, combobox which is bound to list of values.
Scenario...when a user selects a row on the grid i want to set the update the combobox so that the value of a property of the selected item in the datagrid is displayed.
My combobox looks like
< ComboBox DisplayMemberPath="Description" x:Name="cbTopics" Margin="141,170,0,0" VerticalAlignment="Top" Width="300" HorizontalAlignment="Left" SelectedItem="{Binding ElementName=dataGrid1, Path=SelectedItem.Topic.Description, Mode=TwoWay}"/>
In the load event i set the itemssource of the combo to the list of values. I would like to set the combobox to be description of the item selected in the datagrid. The items in the datagrid is a collection of objects
object Code the object Code has a property Topic which has a property of Description (hence why I am trying SelectedItem.Topic.Description).
Any ideas as to what I am doing wrong here? I am trying to setup the relationship between the datagrid selected item and the combobox through xaml only.
thx
Upvotes: 0
Views: 1269
Reputation: 3157
<ComboBox Height="23" HorizontalAlignment="Left" Margin="141,36,0,0"
Name="cbTopics2" VerticalAlignment="Top" Width="399"
SelectedValue="{Binding ElementName=dataGrid1, Path=SelectedItem.Topic.Description, Mode=TwoWay}"
DisplayMemberPath="Description"
SelectedValuePath="Description" />
The above was the solution.
Upvotes: 0