We conntect our ViewModels with our Views via the Caliburn Framework.
Now I need to generate a ListBox dynamically via codebehind. Something like this:
this.LayoutRoot.Children.Add(new ListBox() { Width = 800, ... });
Currently I declare this ListBox explicitly in the Xaml. Because I use Caliburn for placing dialogs, we have a
<silverlightToolkit:TransitioningContentControl caliburn:View.Model="{Binding ViewModel}" />
within this ListBox. How to generate this one? And the most important question: am I able to attatch the caliburn:View.Model property? Like I did it with the Width property on the ListBox? This TransitioningContentControl is nested in the DataTemplate of the ListBoxItem. Is it even possible to generate this via codebehind?
The answer in my codebehind looked like this:
One has to insert
using Caliburn.Micro;, though.