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

Can't read the tag

$
0
0

Hi, I have Combobox with the city names. In Tag of each ComboboxItem I store the index to read it after selection made.

I'm using this code:

Dim TempItem As New ComboBoxItem
TempItem = City.SelectedItem
Dim TempTag as String = TempItem.Tag

Just here I have an exception: value of type 'String' cannot be converted to 'System.Windows.Controls.StackPanel. And I have no idea why it's happens.

If I try to change the last string as following, same problem occur in an editor (blue underline of the part after "="). 

Dim TempTag as String = TempItem.Tag.ToString

How can I retrieve the value from the Tag?

P.s.

By the way, same problem here:

Dim TempTag as String = DirectCast(City.SelectedItem, ComboBoxItem).Tag.ToString


Aleksey



Viewing all articles
Browse latest Browse all 18858

Trending Articles



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