views:

18

answers:

1

Hi,

I am trying to create a multiple user control silverlight application with MVVM pattern. Here is sample of my first page User control

<Grid x:Name="LayoutRoot" Background="GhostWhite" >
    <Grid.ColumnDefinitions>
        <ColumnDefinition Width="100" />
        <ColumnDefinition Width="*" />
    </Grid.ColumnDefinitions>
    <Border Grid.Column="0" Width="90">
        <toolkit:HeaderedContentControl HorizontalAlignment="Left"
      Content="{Binding Path=Commands}"
      ContentTemplate="{StaticResource CommandsTemplate}"
      Header="Control Panel" 
      />
</Border>
<Border Grid.Column="1">
    <ContentControl  ContentTemplate="{StaticResource WorkspacesTemplate}" />
</Border>
</Grid>

My bindings on the Column 0 (list of links) is working fine. Now I would like to bind the views for each of the command to the Column 1 of the grid where I am using the ContentControl. There is no support for DataType in the DataTemplate. The above code where I have used a ContentControl is also not working with IValueConverter Convert(). How do I bind multiple user controls based on selection in the Silverlight Web application.

Thanks, Shankar

A: 

Sounds to me you should be looking at using a navigation:Frame in the right hand pane instead of a ContentControl.

Details are a little hard to provide with so little info about your application in your question.

AnthonyWJones
I would like to map the ViewModel classes in the main UserControl. The Navigation frame is used to map the Views by itself. Is that the way to go?
Shankar
@Shankar: If you're are talking about switching about with views then building those views as navigation pages would seem sensible. The navigation Frame is much more flexable than the typical nav app usage that you normally see it used in. Rather than hard coded mappings you can create a new mapper from `UriMapperBase` that can support your MVVM approach.
AnthonyWJones
Thank you very much. I will check.
Shankar