views:

197

answers:

1

I have a userControl that contains a canvas. I would like to databind items to it so they are positioned automagically.

Here's a great example that shows how to databind items on a canvas, but I want it to work on my specific userControl. (I believe it's not possible to specify a userControl in a ItemsPanelTemplate)

A: 

One option for you, depending on what your UserControl does, is to make your own Canvas subclass, which you can then use in your ItemsPanel (any subclass of Panel works). This assumes that all you were doing with your UserControl was positioning items.

If you really want to use a UserControl, an option off the top of my head would be to add an ItemsControl into your UserControl (which has the Canvas as the ItemsPanel) and bind the items to it via TemplateBinding

Fortes