Hi,
I want to show pop up , serves as suggestion for the textbox.
This is my code,
<Grid><Grid.RowDefinitions><RowDefinition /></Grid.RowDefinitions><TextBox x:Name="txtBox" VerticalAlignment="Top" Text="{Binding TextSearch,UpdateSourceTrigger=PropertyChanged}" TextChanged="txtBox_TextChanged"/><Popup x:Name="autoSuggest" Width="250" Height="100" Placement="Bottom" PlacementTarget="{Binding ElementName=txtBox}" ><ListBox Width="250" Height="100" x:Name="suggestionWords" Background="AliceBlue" SelectionChanged="suggestionWords_SelectionChanged" ItemsSource="{Binding TargetSuggestionWords}"/></Popup></Grid>
private void txtBox_TextChanged(object sender, TextChangedEventArgs e) { if (TextSearch.Length > 0) {TargetSuggestionWords = SuggestionWords.Where(x => x.StartsWith(TextSearch)).ToList(); if (TargetSuggestionWords.Count > 0) {autoSuggest.StaysOpen = true; } } }
I am setting the "IsOpen" property of the PopUp in code behind. But still i am unable to get it.
I have commented out, the popup for checking. The list box is showing perfectly.
But enclosing the listbox in side the popup, is not working.
May i kindly know, where i am mistaking.
Thanks in advance.
NANDAKUMAR.T