I am representing a Solar-System's planets with ImageButtons that show the planet's image on the surface of the button, and hold the planet's important data.. name, distance from sun, etc within an instance of a Planet
class, stored within the ImageButton.Content
property. When the ImageButton
is selected, I am attempting to access and display the Planet
class's data for the selected Planet
. Although ((ImageButton)e.OriginalSource).Content
permits viewing all of the Planet
class's properties in the debugger, I haven't figured out how to access the Planet class properties directly, as in Pluto.DistanceFromTheSun
? Is it possible to access the Planet class information held in the ImageButton
contents directly?
views:
43answers:
1
+1
A:
Presumably you just need another cast:
((Planet)((ImageButton)e.OriginalSource).Content).DistanceFromTheSun
where Planet is the class that Pluto is.
SLC
2010-04-07 14:49:08
Thank you SLC. That's exactly it.Bill
Bill
2010-04-07 15:04:01