Question

I have list of some data items. Each has a method GetStyle which returns ControlTemplate. Previously I was building a custom panel and adding the items as controls into children.

Now I need to group the items and I want to use accordion but I need to find out how can I inject my own template for each item on binding.

Alternatively I can split the items into several panels and add them to the accordion (avoiding data binding) but not sure how either.

I'm using Silverlight 5.

Was it helpful?

Solution

What I have done to make it work:

  • Created lookless control
  • On either Load or ApplyTemplate I inject ControlTemplate into the control
  • Created Accordion content item template as ...
  • Bind Accordion data source to the list of items which has knowledge on what template has to be created.
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top