简体   繁体   中英

WP7 Panorama items binding and adding other custom panorama items c#

I am running into an issue where i am using a panorama control and binding it to a datasource. But i still do want other custom items on another panorama items where i need a textblock, a grid and so on. So if i am adding it in the backend it doesnt show up those panorama items. It just shows the datasource binded items. Why is that so? Both of them should work out.

Can anybody help me with a solution for this.

Thank You.

Since you're wanting to manually add PanoramaItems, I can think of two approaches:

  1. Make sure your Panorama.ItemsSource is set to an ObservableCollection that is accessible in the code behind or viewmodel, and then add your new items to that ObservableCollection which should update the Panorama.

  2. Don't databind the Panorama control's Items - just add items manually when you want them.

Either way, the Panorama's ItemTemplate gets evaluated when the items are added to the underlying collection, so using a DataTemplateSelector will allow your code to determine which DataTemplate to apply when the new item is added without affecting the templates for previous items.

/chris

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM