Reputation: 10244
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 a WPF toolkit AutoCompleteBox 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.
Upvotes: 0
Views: 2013
Reputation: 21
i guess you encountered a bug: https://connect.microsoft.com/VisualStudio/feedback/details/595640/autocompletebox-does-not-update-visible-text
Upvotes: 2