I have a user control which I use as a listboxItem. On this user control there is an image and if that image is tapped I want to access the data of the item itself.
For example:
I load all contacts into the listbox and on tap of the image I want to initialize a phonecall task. Let’s say the phone number and name of the contact are in two different texblocks inside the user control. How can I get these two values into my task?
I tried finding the values in the sender object but couldn’t do it.
It’s a pretty basic question but I can’t seem to find the answer, could someone help me out please?
did you try something like
var selected = ((ListBox) sender).SelectedItem as MyCustomControl;in your listbox selection changed event?That should give you access to your custom control object where you can access the phone number and name properties.
* actual syntax may vary *