Monday, December 31, 2012

Autocompletebox SelectedText Bug

Autocompletebox SelectedText Bug

I want to bind both the SelectedText and SelectedItem properties of an AutocompleteBox because my client wants to be able to input text and select from the list also. It's working properly but ...

The MainPage has one DataGrid. When I select a record from the Grid (i.e. SelectedItem), I want to set it in a popup window's AutocompleteBox. Some times it works but some times it doesn't.

What should I do for this issue?

This is my XAML:

<customTookit:AutoCompleteBox Grid.Column="3" Grid.Row="3" Height="18" Width="150"       IsTextCompletionEnabled="True" TabIndex="9" HorizontalAlignment="Left"      IsPopulated="{Binding ElementName=ResEdit,Path=DataContext.IsDrop,Mode=TwoWay}"      Text="{Binding ElementName=ResEdit,Path=DataContext.SelectedDemoText,Mode=TwoWay}"      ItemsSource="{Binding ElementName=ResEdit,Path=DataContext.DemoList,Mode=OneWay}"      ItemTemplate="{StaticResource DemoTemplate}"      ValueMemberPath="DemoCode"       LostFocus="AutoCompleteBox_LostFocus_1"      Margin="0,0,21,0" Padding="0">   </customTookit:AutoCompleteBox> 

This property is in my view-model and bound to the DataGrid:

public InvoicesDTO SelectedInvoice {     get { return _selectedInvoice; }     set     {         SelectedInvoice = value;         SelectedDomoText = SelectedInvoice.DemoText.Trim();         RaisePropertyChanged("SelectedInvoice");     } } 

Answers & Comments...




No comments:

Post a Comment

Send us your comment related to the topic mentioned on the blog