I'm having a ComboBox in which I added items in order provide the user autocomplete for the text he's typing. I am looking for a property of ComboBoxes that could identify if the text was an item of the ComboBox or not. (I would like not to loop each time through its items). I would like do use ComboBox.Text if the item does not exist and ComboBox.SelectedItem if it does. Thanks.

Member Avatar
Member Avatar
+0 forum 4

Hi All, I'm trying to bind a textbox to a listbox's selected.Content properties. The listbox displays the items as designed in the datatemplate. But I can't get a textbox to display one/any of the selectedItems properties. [B]DataTemplate[/B] [CODE] <DataTemplate x:Key="dt_Afloeser" > <Border BorderBrush="Black" BorderThickness="0.5" CornerRadius="2" Margin="2,2,2,2"> <DockPanel HorizontalAlignment="Center"> <TextBlock Name="navn" Text="{Binding Path=navn}" Margin="2,2,2,2" HorizontalAlignment="Left" VerticalAlignment="Center" TextWrapping="WrapWithOverflow" /> <TextBlock Width="20"/> <TextBlock Name="telefonNr" Text="{Binding Path=telefonNr}" Margin="2,2,10,2" Width="auto" HorizontalAlignment="Left" VerticalAlignment="Center" TextWrapping="WrapWithOverflow" /> </DockPanel> </Border> </DataTemplate> [/CODE] The DataContext for the Listbox is set in code. [CODE] <ListBox Name="lb_Afloesere" ItemsSource="{Binding}" ItemTemplate="{StaticResource dt_Afloeser}" IsEnabled="True" /> [/CODE] This only shows namespace.Afloeser [CODE] <TextBox Text="{Binding ElementName=lb_Afloesere, Path=SelectedItem}" …

Member Avatar
Member Avatar
+0 forum 1

The End.