tags:

views:

13

answers:

1

Does anyone have a walk through/example/blog of how I can dynamically create the item template of an items control in the code behind?

I have an object that has a dynamic number of properties and I'm needing to vary the output but I'm having difficulty getting started.

I've created a few from XAML but never done it from the code behind.

Vb or C# is fine, but C# is preferred

+1  A: 

Basically you would need to create a DataTemplate, and use a FrameworkElementFactory to create the layout. There is an example given on the Microsoft forum.

http://social.msdn.microsoft.com/forums/en-US/wpf/thread/f230804d-fc0f-4321-a61e-69a2c890b28d/

JoshVarga