如何在后面的代码中创建ItemsControl ItemTemplate [英] How to create Itemscontrol ItemTemplate in code behind
问题描述
我有一个对象这有一个动态数量的属性,我需要改变输出,但我很难入门。
我已经从XAML创建了一些,但从来没有
Vb或C#很好,但C#是首选
基本上,您将需要创建一个DataTemplate,并使用FrameworkElementFactory创建布局。在Microsoft论坛上有一个例子。
http://social.msdn.microsoft.com/forums/en-US/wpf/thread/f230804d-fc0f-4321-a61e-69a2c890b28d /
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
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/
这篇关于如何在后面的代码中创建ItemsControl ItemTemplate的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!