Silverlight Combobox and Selected item problem
The title may sound simple and dumb, but allow me to explain.
I am using WCF RIA Services to bind a combobox to a list of say, countries. The control housing the entire control os already bound to a datacontext, and the country is among the data in the context.
How can I go about binding the comboxbox's selected item to the country in the entire context, while the entire list is coming from the RIA Datasource in the xaml. Code is as follows:
<riaControls:DomainDataSource AutoLoad="True" LoadedData="countryDomainDataSource_LoadedData" x:Name="countryDomainDataSource" QueryName="GetCountriesQuery" VerticalAlignment="Top">
<riaControls:DomainDataSource.DomainContext>
<my:ApplyDataContext />
</riaControls:DomainDataSource.DomainContext>
</riaControls:DomainDataSource>
<ComboBox x:Name="CountryCB" Grid.Column="1" Margin="10,3,92,4" Grid.Row="10" ItemsSource="{Binding Data, ElementName=countryDomainDataSource}" DisplayMemberPath="Co开发者_开发百科untry1" SelectedValuePath="{Binding NationalCountry}" />
Problem solved. i, instead, bound the control to the actual item, then rebound it to the itemsource when the edit button was clicked.
精彩评论