How to get elements from an object in C#?
Posted
by
Drew
on Stack Overflow
See other posts from Stack Overflow
or by Drew
Published on 2011-01-06T20:53:11Z
Indexed on
2011/01/06
20:53 UTC
Read the original article
Hit count: 284
I am using the AutoCompleteBox in WPF, I populate the suggestions with a List that consists of four fields. When the user selects an item and I reach my eventHandler, i can see that
MyAutoCompleteBox.SelectedItem
is an object that has my four values, if i hover this text in the debugger i can see the four values listed, however i don't know how to access these values in the code.
I tried
List<Codes> selected = MyAutoCompleteBox.SelectedItem as List<Codes>;
where Codes is my List. selected returns as null and empty every time. Is there a way to get to these values? Thanks!
© Stack Overflow or respective owner