2

Is there a way to program to show what the selected panorama item is on screen, and if so what the content property of it is?

I have three panorama items (1, 2, 3) and each have a single rectangle with a rectangle.fill of an image.

I want to design an applicationbar button that, when clicked, acknowledge what the rectangle.fill on the screen is in the panorama item, and then add it to another page in the application.

Is this even possible to do? I imagine selectedindexitem or something similar will tell me what is the current on screen panorama is, but if so, how could I pull the rectangle.fill information?

Craig
  • 21
  • 1

1 Answers1

1

pano.SelectedItem will give you a reference to the currently displayed PanoramaItem, and you can get a reference to the root object of its visual tree simply by casting pano.SelectedItem.Content appropriately.

The style guide specifically says not to use the application bar in Panorama or Pivot applications. Since you can't use the appbar I suggest you're going to use a grid containing a Rectangle and a Button.

Presumably you have code populating your rectangles with images; when you do this you should also populate a lookup so you can use the panoItem to get whatever it is you're after. If you were to show the XAML for your page I could be a lot more specific with my advice.

Assuming you're loading these images from the filesystem and a variable filePath currently contains the filepath you just loaded onto a pano item panoItem, then your code should end up something like this:

//lookup
Dictionary<PanoramaItem, string> _panoPicPath = new Dictionary<PanoramaItem, string>();
...
//populate lookup
_panoPicPath[panoItem] = filePath;
...
//fetch filePath for selected 
string selectedFilePath = _panoPicPath[pano.SelectedItem];
Peter Wone
  • 17,965
  • 12
  • 82
  • 134