How can I tell my DataTemplate to bind to a property in the PARENT ViewModel?

The answer is this:

<DataTemplate x:Key="CodeGenerationMenuTemplate">
    <MenuItem 
        Header="{Binding Title}" 
        Command="{Binding DataContext.SwitchPageCommand,
    RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Menu}}}" 
        CommandParameter="{Binding Title}"/>
</DataTemplate>

I just saw that Nir had given me the syntax to solve the above issue on this question: What is the best way in MVVM to build a menu that displays various pages?.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)