views:

316

answers:

1

I have an AutoCompleteBox that uses RIA DomainDataSource for the query to the server. I need to bind the AutoComplete.SelectedItem to the ViewModel.SelectedEmployee. They share the same DomainContext and data, but have different queries. When I try the following:

ViewModel.SelectedEmployee = autoCompleteBox1.ItemsSource; I get the error: Error 1 Cannot implicitly convert type 'System.Collections.IEnumerable' to HeadCount.Web.Employee' ie, it don't work- I know I could share the queries, but since I have a very large data source this is not possible.
I have managed to display the selected item columns in a datagrid and a button content, but just cannot figure out how to make the app understand it is the same data. I have been at it for hours, need a little info Thx

A: 

I found the answer- a missing cast. This line of code made it work- ViewModel.SelectedEmployee = autoCompleteBox1.SelectedItem as HeadCount.Web.Employee; –

isitdanny