title: C# wpf caliburn.Micro MahApps HamburgerMenu.ContentTemplate data binding is not working
body: <p>I'm making an application using Caliburn.Micro(for easy data binding and stuff) and MahApps.Metro(for designing).</p>
  
  <p>I've created a View name 'MainView' which has <code>HamburgerMenu</code> of MahApps.
  My issue is data binding is working fine under <code>HamburgerMenu.ContentTemplate</code> tag</p>
  
  <p>Here is my <code>HamburgerMenu.ContentTemplate</code> xaml.</p>
  
  <pre><code>&lt;Page x:Class="Sample.Views.MainView"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:cal="http://www.caliburnproject.org"
        xmlns:mah="clr-namespace:MahApps.Metro.Controls;assembly=MahApps.Metro"
        xmlns:iconPacks="http://metro.mahapps.com/winfx/xaml/iconpacks"
        xmlns:utils="clr-namespace:Omni.WindowsClient.Utils"
        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
        xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
        xmlns:local="clr-namespace:Omni.WindowsClient.Views"
        mc:Ignorable="d"
        d:DesignHeight="300"
        d:DesignWidth="600"&gt;
  
      &lt;Page.Resources&gt;
          &lt;DataTemplate x:Key="HamburgerMenuItem"
                        DataType="{x:Type mah:HamburgerMenuItem}"&gt;
              &lt;Grid Height="48"&gt;
                  &lt;Grid.ColumnDefinitions&gt;
                      &lt;ColumnDefinition Width="48" /&gt;
                      &lt;ColumnDefinition /&gt;
                  &lt;/Grid.ColumnDefinitions&gt;
                  &lt;Image Margin="12"
                         HorizontalAlignment="Center"
                         VerticalAlignment="Center"
                         Source="{Binding Glyph}"
                         Stretch="UniformToFill" /&gt;
                  &lt;TextBlock Grid.Column="1"
                             VerticalAlignment="Center"
                             FontSize="16"
                             Foreground="White"
                             Text="{Binding Label}" /&gt;
              &lt;/Grid&gt;
          &lt;/DataTemplate&gt;
      &lt;/Page.Resources&gt;
  
      &lt;Grid&gt;
  
          &lt;mah:HamburgerMenu x:Name="HamburgerMenuControl"
                             SelectedIndex="0"
                             ItemTemplate="{StaticResource HamburgerMenuItem}"
                             OptionsItemTemplate="{StaticResource HamburgerMenuItem}"
                             IsPaneOpen="True"
                             DisplayMode="CompactInline"
                             cal:Message.Attach="[Event ItemClick] = [Action ShowDetails(HamburgerMenuControl.SelectedItem)]"
                             DataContext="{Binding RelativeSource={RelativeSource self}}"&gt;
              &lt;mah:HamburgerMenu.ItemsSource&gt;
                  &lt;mah:HamburgerMenuItemCollection&gt;
                      &lt;mah:HamburgerMenuItem Label="System Status"&gt;
                          &lt;mah:HamburgerMenuItem.Tag&gt;
                              &lt;iconPacks:PackIconFontAwesome Width="22"
                                                             Height="22"
                                                             HorizontalAlignment="Center"
                                                             VerticalAlignment="Center"
                                                             Kind="Tasks" /&gt;
                          &lt;/mah:HamburgerMenuItem.Tag&gt;
                      &lt;/mah:HamburgerMenuItem&gt;
                      &lt;mah:HamburgerMenuItem Label="Inbox"&gt;
                          &lt;mah:HamburgerMenuItem.Tag&gt;
                              &lt;iconPacks:PackIconFontAwesome Width="22"
                                                             Height="22"
                                                             HorizontalAlignment="Center"
                                                             VerticalAlignment="Center"
                                                             Kind="Inbox" /&gt;
                          &lt;/mah:HamburgerMenuItem.Tag&gt;
                      &lt;/mah:HamburgerMenuItem&gt;
                          &lt;mah:HamburgerMenuItem.Tag&gt;
                              &lt;iconPacks:PackIconFontAwesome Width="22"
                                                             Height="22"
                                                             HorizontalAlignment="Center"
                                                             VerticalAlignment="Center"
                                                             Kind="Certificate" /&gt;
                          &lt;/mah:HamburgerMenuItem.Tag&gt;
                      &lt;/mah:HamburgerMenuItem&gt;
                  &lt;/mah:HamburgerMenuItemCollection&gt;
              &lt;/mah:HamburgerMenu.ItemsSource&gt;
  
              &lt;mah:HamburgerMenu.ContentTemplate&gt;
                  &lt;DataTemplate DataType="{x:Type mah:HamburgerMenuItem}"&gt;
                      &lt;Grid utils:GridUtils.RowDefinitions="48,*"&gt;
                          &lt;!--cal:Action.TargetWithoutContext="{Binding ElementName=HamburgerMenuControl, Path=DataContext}"--&gt;
                          &lt;Border Grid.Row="0"
                                  Background="{DynamicResource MahApps.Metro.HamburgerMenu.PaneBackgroundBrush}"&gt;
                              &lt;TextBlock x:Name="Header"
                                         HorizontalAlignment="Center"
                                         VerticalAlignment="Center"
                                         FontSize="24"
                                         Foreground="White" /&gt;
                              &lt;!--Text="{Binding Path=Header, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"--&gt;
                          &lt;/Border&gt;
                          &lt;Frame Grid.Row="1"
                                 cal:Message.Attach="RegisterFrame($source)"
                                 DataContext="{x:Null}"
                                 NavigationUIVisibility="Hidden" /&gt;
                      &lt;/Grid&gt;
                  &lt;/DataTemplate&gt;
              &lt;/mah:HamburgerMenu.ContentTemplate&gt;
  
          &lt;/mah:HamburgerMenu&gt;
  
      &lt;/Grid&gt;
  &lt;/Page&gt;
  </code></pre>
  
  <p>and respective view model code is:</p>
  
  <pre><code>using Caliburn.Micro;
  using MahApps.Metro.Controls;
  using System.Windows.Controls;
  
  namespace Sample.ViewModels
  {
      public class MainViewModel : Screen
      {
          private readonly SimpleContainer _container;
          private INavigationService _navigationService;
          private string _header;
  
          public string HeaderTitle
          {
              get { return _header; }
              set
              {
                  _header = value;
                  NotifyOfPropertyChange();
              }
          }
  
          public MainViewModel(SimpleContainer container)
          {
              this._container = container;
              DisplayName = "Main";
          }
  
          public void RegisterFrame(Frame frame)
          {
              _navigationService = new FrameAdapter(frame);
              _container.Instance(_navigationService);
              _navigationService.NavigateToViewModel(typeof(SystemStatusViewModel));
              HeaderTitle = "System Status";
          }
  
          public void ShowDetails(HamburgerMenuItem menuItem)
          {
              switch (menuItem.Label)
              {
                  case "System Status":
                      _navigationService.NavigateToViewModel(typeof(SystemStatusViewModel));
                      HeaderTitle = "System Status";
                      break;
                  case "Inbox":
                      _navigationService.NavigateToViewModel(typeof(InboxViewModel));
                      HeaderTitle = "Inbox";
                      break;
                  default:
                      break;
              }
          }
  
      }
  }
  </code></pre>
  
  <p>I want to change View in frame under <code>HamburgerMenu.ContentTemplate</code> when I click on menu item.
  Like System Status view is SystemStatusView
  and Inbox view is InboxView.</p>
  
  <p>My code is working fine (it changes the view in frame and change the Header label too) if I don't use <code>HamburgerMenu.ContentTemplate</code>. But I want to use <code>HamburgerMenu.ContentTemplate</code> to work with <code>HamburgerMenu</code>.</p>
  
  <p>Thanks!</p>