开发者

Silverlight Combobox and Selected item problem

开发者 https://www.devze.com 2023-03-18 06:09 出处:网络
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

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号