I have a Pivotpage with pivotitems generated from an ObservableCollection in my ViewModel.

To make more understandable what i want to do, lets say those items represent folders and the content of the items are the files located in this folder.

What I want to do is to create a static PivotItem (as the last element in the pivot control) to create a new folder. This item would have a totally different GUI and thus can not be generated by the same ItemTemplate.

I had the following ideas:

  • Adding an additional object with a special key to the ObservableCollection and render it somehow different (conditional rendering in my ItemTemplate, but I could not find anything on this topic)

  • Add an additional element from code, which does not work for me, because the databound pivot control is read-only

  • Add the static item directly in XAML (gets obviously overwritten)

Is there any possibility to do this?

有帮助吗?

解决方案

Add all your views to your ObservableCollection and use a TemplateSelector to chose how it will be displayed.

See here how to implement it: http://visualstudiomagazine.com/articles/2012/08/06/multiple-item-templates-in-windows-phone.aspx

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top