I want to bind a combox with my entity model via domain services.
My entity model:
COUNTRIES (ID, NAME)
TABLE_TEST (PK_FIELD, FIELD2, COUNTRY_ID)
I created my entity model and the domain service.
My Xaml:
<riaControls:DomainDataSource AutoLoad="True" d:DesignData="{d:DesignInstance my:COUNTRIES, CreateList=true}" Height="0" Name="COUNTRIESDomainDataSource" QueryName="GetCOUNTRIESQuery" Width="0">
<riaControls:DomainDataSource.DomainContext>
<my:DomainService1 />
</riaControls:DomainDataSource.DomainContext>
</riaControls:DomainDataSource>
<riaControls:DomainDataSource AutoLoad="True" d:DesignData="{d:DesignInstance my:TABLE_TEST, CreateList=true}" Height="0" Name="TABLE_TESTDomainDataSource" QueryName="GetTABLE_TESTQuery" Width="0">
<riaControls:DomainDataSource.DomainContext>
<my:DomainService1 />
</riaControls:DomainDataSource.DomainContext>
</riaControls:DomainDataSource>
<ComboBox Name="COUNTRIESComboBox"
DataContext="{Binding ElementName=COUNTRIESDomainDataSource, Path=Data}" ItemsSource="{Binding}"
DisplayMemberPath="ID"
SelectedValuePath="NAME"
SelectedValue="{Binding ElementName=TABLE_TESTDomainDataSource, Path=COUNTRY_ID}">
</ComboBox>
The combobox is loaded with the correct values (all countries) but looks like it’s not bounded with TABLE_TEST. When I change the register of TABLE_TEST, the value of the combo does not change.
What I am doing wrong? I looked many examples but no one is the same escenario, with domain data source and entity model.
I’m working with silverlight 5
Thanks
The DomainDataSource is an extremely bad fit as a datasource for Silverlight ComboBoxes. So far I’ve found Kyle McClennan’s [MSFT] ComboBoxDataSource the most reliable in the use case you’ve described. In fact, he advised:
In particular, you need to mark your combobox as being Async in the final attribute.