我们通过 Caliburn 框架将 ViewModel 与 View 连接起来。
现在我需要ListBox
通过代码隐藏动态生成一个。像这样的东西:
this.LayoutRoot.Children.Add(new ListBox() { Width = 800, ... });
目前我ListBox
在 Xaml 中明确声明了这一点。因为我使用 Caliburn 来放置对话框,所以我们有一个
<silverlightToolkit:TransitioningContentControl caliburn:View.Model="{Binding ViewModel}" />
这里面ListBox
。如何生成这个?最重要的问题是:我能附上caliburn:View.Model
房产吗?就像我Width
对ListBox
? 这TransitioningContentControl
是嵌套DataTemplate
在ListBoxItem
. 甚至可以通过代码隐藏生成它吗?