>>The autocomplete control is based on the standard ComboBox so bindings should work in the same way. Checking the Output window might give a clue as to what is wrong with the binding ( e.g.
http://www.codeproject.com/Articles/244107/Debugging-WPF-data-bindings).
>>
>
>This is what I thought. I've looked at my code again and realised I did some things incorrectly, but I'm still not getting a customer number to display in the combo.
>
>The bindings look right. The datacontext for the combo is my Invoice entity and the settings which should control it are:
>
>
<ctr:AutoComplete x:Name="autoCustomers" Grid.Row="3" Grid.Column="1"
> SelectedValuePath="cus_PK" DisplayMemberPath="cus_number"
> SelectedValue="{Binding inv_cusfk, Mode=Default}"
> PatternChanged="autoCustomers_PatternChanged"
> Delay="500" LostFocus="autoCustomers_LostFocus" />
>
>I think the only thing I am not getting quite right is the setting of the ItemsSource. I have this code:
>
>this.autoCustomers.ItemsSource = this.Customer.GetAllEntities();
>
>which runs fine, but then when I start loading my data (after the user enters some search criteria) I get this error:
>
>System.Data.RowNotInTableException was unhandled by user code
> HResult=-2146232024
> Message=This row has been removed from a table and does not have any data. BeginEdit() will allow creation of new data in this row.
> Source=System.Data
> StackTrace:
> at System.Data.DataRow.get_Item(String columnName)
> at SamaanSystems.IBC.Business.CustomerEntity.get_cus_PK() in D:\Development\VS2010\IBC\IBC Business Objects\Customer\CustomerEntity.cs:line 443
> InnerException:
That doesn't sound like a databinding issue. Any clues in Remarks here :http://msdn.microsoft.com/en-us/library/system.data.rownotintableexception.aspx (or in the full stacktrace) ?
>>BTW, did Visiblity.Collapsed work ?
>
>I did try it and it worked a bit better than using Hidden, however there were some problems: it displayed the first time I clicked in the textbox, and then the combo disappeared and teh textbox re-appeared when I left the combo, but it wouldn't work the second time I clicked into the textbox. I am really hoping I could get the combo to work properly so have not tried to work out what is going on with this yet.
I'd agree - two ComboBoxes would always be a kludge :-}