I have been playing around with Caliburn Micro for some time.
The application that I am working on consists of an MainAppView, MainAppMenuView and MainAppContentView. With corresponding ViewModels. All this works fine.
Now in the MainAppContentView I would like to show several UserControl's, that look like Windows 8 Startscreen Tiles, dynamically. Meaning that the user should be able to select what UserControl's the app will show, from a ListBox.
So I am creating several Views and ViewModels for this. And now have a collection of different tiles the user can select from.
The thought was to have a Tile model:
namespace CaliburnMicro.Test.Model
{
public class Tile
{
public int ID { get; set; }
public string View { get; set; }
public List<string> Views { get; set; }
public string TileSize { get; set; }
}
}
And then resolve what View/ViewModel to show from the Tile.View or Tile.Views property.
Have anyone any idea about how this can be acomplished with Caliburn Micro?
I have have tried to solve it by makeing a DataTemplate like this:
<DataTemplate>
<Grid Margin="4">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="50*" />
<ColumnDefinition Width="50*" />
<ColumnDefinition Width="50*" />
</Grid.ColumnDefinitions>
<TextBlock Text="{Binding ID}" FontWeight="Bold" />
<TextBox Grid.Column="1" Text="{Binding ID }" />
<ContentControl Grid.Column="2" cal:View.Model="{Binding View}" />
</Grid>
</DataTemplate>
Ideas, link's to samples or anything... would be highly appreciated.
ViewModel
for each? β Chris