Quantcast
Channel: Windows Presentation Foundation (WPF) forum
Viewing all articles
Browse latest Browse all 18858

ComboBox Text

$
0
0

Hi!

in a editable ComboBox that is binding to a Database, i want to check if  text exist in ComboBox items.

<ComboBox DataContext="{StaticResource vehiclesViewSource}" DisplayMemberPath="vehicle" ItemsSource="{Binding}"
TextBox.TextChanged="vehicleComboBox" IsEditable="True" IsTextSearchEnabled="True" IsTextSearchCaseSensitive="False"/>

bool itemExists =false;foreach(ComboBoxItem cbi in cb.Items){ itemExists = cbi.Content.Equals(cb.Text);if(itemExists)break;

...}

but i get a runtime exception


Viewing all articles
Browse latest Browse all 18858

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>