This project has moved. For the latest updates, please go here.

AutoCompleteBox Selection

Apr 29, 2011 at 7:45 AM

I have an object bound to controls in a window. There's a property on this object called "Region", and an ObjectDataProvider which is populated with a list of available "Regions". I'm using an autocmplete box to select the region selected but the value selected isn't update to reflect the region of the object. Eg: If I use the code below, I can open/save the form and the AutoCompleteBox appears blank, even though the region is saved (so it must be bound, but invisible?)

<input:AutoCompleteBox x:Name="txtRegionAuto" Grid.Row="0" Grid.Column="1" IsTextCompletionEnabled="False" ValueMemberPath="Region"   ItemTemplate="{StaticResource RegionDataTemplate}" Margin="2,4"
                                                   Style="{StaticResource AutoCompleteComboBoxStyle}" TabIndex="8" SelectedItem="{Binding Region,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" SelectionChanged="lstRegion_SelectionChanged"
                                                   ItemsSource="{Binding Source={StaticResource regionProvider}}" MinimumPopulateDelay="400" />

The only way I can get the region to display in the box is with:
txtRegionAuto.SelectedItem = regions.FirstOrDefault(c => c.RegionID == region.RegionID);

But then when I come to save the form, the Region property on my object is null. I'm sure it's just a case of setting the right value binding, but I'm not sure what to use.

Apr 29, 2011 at 1:26 PM

The AutoCompleteBox is not part of the Extended WPF Toolkit.  Therefore I will not be providing support for it.  Thanks.