Really short version
Wrap content in a PanoramaItem to get the SelectionChanged event to fire.
Somewhat longer version, but still short
If you programmatically create a Panorama control in, let's say a custom renderer for WP8.0 (silverlight) when using forms, wrap any content in an PanoramaItem if you want events to fire.
Not working
var root = new Panorama();
root.SelectionChanged += (s, a) => { Debug.WriteLine("Will not fire"); };
root.Items.Add(new System.Windows.Controls.Image()
{
Source = new BitmapImage(new Uri("" ))
});
Working
var root = new Panorama();
root.SelectionChanged += (s, a) => { Debug.WriteLine("Will fire"); };
root.Items.Add(
new PanoramaItem()
{
Content = new System.Windows.Controls.Image()
{
Source = new BitmapImage(new Uri("" ))
}
});
By the way, if you are using data binding and not getting it to work, this stackoverflow post might help: http://stackoverflow.com/questions/14260701/
No comments:
Post a Comment