Visibility of Class field-data of Mouse Clicked ImageButton located within WrapPanel
- by Bill
I am attempting to obtain the class-data behind an ImageButton that is mouse-clicked; which ImageButton is located within a WrapPanel filled with ImageButtons. The problem I am having is obtaining the visibility of the field data within the class behind the image-button. Although I can see the class, I can neither see nor access the field data. Can anyone please point me in the right direction?
// Handles the ImageButton mouseClick event within the WrapPanel.
private void SolarSystem_Click(Object sender, RoutedEventArgs e)
{
FrameworkElement fe = e.OriginalSource as FrameworkElement;
SelectedPlanet PlanetSelected = new SelectedPlanet(fe);
PlanetSelected.Owner = this;
MessageBox.Show(PlanetSelected.PlanetName);
}
// Used to initiate instance of Class and some field data.
public SelectedPlanet(FrameworkElement fe)
{
InitializeComponent();
string sPlanetName = ((PlanetClass)(fe)).PlanetName;
return sPlanetName
}
// Class Data
public class PlanetClass
{
string planetName;
public PlanetClass(string planetName)
{
PlanetName = planetName;
}
public string PlanetName
{
set { planetName = value; }
get { return planetName; }
}
}