title: MasterDetailsView not showing master list items despite setting properties
body: <p>After following Microsoft's code for the <code>MasterDetailsView</code> control, the master list appears blank and doesn't show any items at all? Why has this happened and how can this be fixed?</p>
  <p><em>MasterDetailPage.xaml</em></p>
  <pre><code>&lt;Page
      x:Class=&quot;MyApp.MasterDetailPage&quot;
      xmlns=&quot;http://schemas.microsoft.com/winfx/2006/xaml/presentation&quot;
      xmlns:x=&quot;http://schemas.microsoft.com/winfx/2006/xaml&quot;
      xmlns:local=&quot;using:MyApp&quot;
      xmlns:controls=&quot;using:Microsoft.Toolkit.Uwp.UI.Controls&quot;
      xmlns:d=&quot;http://schemas.microsoft.com/expression/blend/2008&quot;
      xmlns:mc=&quot;http://schemas.openxmlformats.org/markup-compatibility/2006&quot;
      xmlns:data=&quot;using:MyApp.Models&quot;
      mc:Ignorable=&quot;d&quot;
      Background=&quot;{ThemeResource ApplicationPageBackgroundThemeBrush}&quot;&gt;
  
      &lt;Grid&gt;
          &lt;controls:MasterDetailsView BackButtonBehavior=&quot;Automatic&quot; 
                                      x:Name=&quot;MyMasterDetailsView&quot;
  
                                      NoSelectionContent=&quot;Select an item to view&quot;
                                      CompactModeThresholdWidth=&quot;720&quot;&gt;
              &lt;controls:MasterDetailsView.ItemTemplate&gt;
                  &lt;DataTemplate&gt;
                      &lt;StackPanel Margin=&quot;0,8&quot;&gt;
                          &lt;TextBlock Text=&quot;{Binding From}&quot; 
                                     Style=&quot;{ThemeResource SubtitleTextBlockStyle}&quot;/&gt;
                          &lt;TextBlock Text=&quot;{Binding Body}&quot; 
                                     Style=&quot;{ThemeResource BodyTextBlockStyle}&quot; 
                                     Opacity=&quot;.6&quot; 
                                     MaxLines=&quot;1&quot;/&gt;
                      &lt;/StackPanel&gt;
                  &lt;/DataTemplate&gt;
              &lt;/controls:MasterDetailsView.ItemTemplate&gt;
              &lt;controls:MasterDetailsView.DetailsTemplate&gt;
                  &lt;DataTemplate&gt;
                      &lt;RelativePanel Margin=&quot;24&quot;&gt;
                          &lt;controls:ImageEx x:Name=&quot;FromEllipse&quot;
                                                 Source=&quot;{Binding Thumbnail}&quot;
                                                 Width=&quot;50&quot;
                                                 Height=&quot;50&quot;
                                                 CornerRadius=&quot;999&quot;/&gt;
                          &lt;TextBlock Text=&quot;{Binding From}&quot; 
                                     Style=&quot;{ThemeResource SubtitleTextBlockStyle}&quot; 
                                     RelativePanel.RightOf=&quot;FromEllipse&quot; 
                                     Margin=&quot;12,-6,0,0&quot;/&gt;
                          &lt;TextBlock x:Name=&quot;SubjectLine&quot;
                                     Text=&quot;{Binding Subject}&quot; 
                                     Style=&quot;{ThemeResource BodyTextBlockStyle}&quot; 
                                     RelativePanel.Below=&quot;FromEllipse&quot;
                                     Margin=&quot;0,12,0,0&quot;/&gt;
                          &lt;TextBlock x:Name=&quot;Body&quot; 
                                     Text=&quot;{Binding Body}&quot; 
                                     Style=&quot;{ThemeResource BodyTextBlockStyle}&quot; 
                                     TextWrapping=&quot;Wrap&quot; 
                                     RelativePanel.Below=&quot;SubjectLine&quot; 
                                     Margin=&quot;0,12,0,0&quot;/&gt;
                      &lt;/RelativePanel&gt;
                  &lt;/DataTemplate&gt;
              &lt;/controls:MasterDetailsView.DetailsTemplate&gt;
              &lt;controls:MasterDetailsView.NoSelectionContentTemplate&gt;
                  &lt;DataTemplate&gt;
                      &lt;StackPanel HorizontalAlignment=&quot;Center&quot; 
                                  VerticalAlignment=&quot;Center&quot;&gt;
                          &lt;SymbolIcon Symbol=&quot;Mail&quot; 
                                      RenderTransformOrigin=&quot;.5,.5&quot;&gt;
                              &lt;SymbolIcon.RenderTransform&gt;
                                  &lt;CompositeTransform 
                                    ScaleX=&quot;2&quot; 
                                    ScaleY=&quot;2&quot;/&gt;
                              &lt;/SymbolIcon.RenderTransform&gt;
                          &lt;/SymbolIcon&gt;
                          &lt;TextBlock Text=&quot;{Binding}&quot; 
                                     FontSize=&quot;24&quot; 
                                     Margin=&quot;0,12&quot;/&gt;
                      &lt;/StackPanel&gt;
                  &lt;/DataTemplate&gt;
              &lt;/controls:MasterDetailsView.NoSelectionContentTemplate&gt;
              &lt;controls:MasterDetailsView.MasterCommandBar&gt;
                  &lt;CommandBar&gt;
                      &lt;AppBarButton Icon=&quot;Back&quot; Label=&quot;Back&quot;/&gt;
                      &lt;AppBarButton Icon=&quot;Forward&quot; Label=&quot;Forward&quot;/&gt;
  
            &lt;CommandBar.Content&gt;
              &lt;TextBlock Margin=&quot;12,14&quot;&gt;
                &lt;Run Text=&quot;{Binding Emails.Count}&quot; /&gt;
                &lt;Run Text=&quot;Items&quot; /&gt;
              &lt;/TextBlock&gt;
            &lt;/CommandBar.Content&gt;
          &lt;/CommandBar&gt;
        &lt;/controls:MasterDetailsView.MasterCommandBar&gt;
        &lt;controls:MasterDetailsView.DetailsCommandBar&gt;
          &lt;CommandBar&gt;
            &lt;AppBarButton Icon=&quot;MailReply&quot; Label=&quot;Reply&quot; /&gt;
            &lt;AppBarButton Icon=&quot;MailReplyAll&quot; Label=&quot;Reply All&quot; /&gt;
            &lt;AppBarButton Icon=&quot;MailForward&quot; Label=&quot;Forward&quot; /&gt;
          &lt;/CommandBar&gt;
        &lt;/controls:MasterDetailsView.DetailsCommandBar&gt;
      &lt;/controls:MasterDetailsView&gt;
    &lt;/Grid&gt;
  &lt;/Page&gt;
  </code></pre>
  <p><em>MasterDetailPage.xaml.cs</em></p>
  <pre><code>    public sealed partial class MasterDetailPage: Page
      {
          public MasterDetailPage()
          {    
              this.InitializeComponent();
  
          Binding myBinding = new Binding()
          {
              Source = Emails,
              Mode = BindingMode.OneWay
          };
  
          MyMasterDetailsView.SetBinding(MasterDetailsView.ItemsSourceProperty, myBinding);
  
              var emails = MyEmailManager.GetEmails();
              emails.ForEach(email =&gt; Emails.Add(email));
          }
  
          public ObservableCollection&lt;Email&gt; Emails = new ObservableCollection&lt;Email&gt;();
  
          public void OnXamlRendered(FrameworkElement control)
          {
              control.DataContext = this;
          }
      }
  </code></pre>
  <p>    </p>
  <p><em>Email.cs</em></p>
  <pre><code>    public class Email
      {
          public string From { get; set; }
          public string Body { get; set; }
      }
  
      public class MyEmailManager
      {
          public static List&lt;Email&gt; GetEmails()
          {
              var MyEmails = new List&lt;Email&gt;
              {
                  new Email
                  {
                      From = &quot;Steve Johnson&quot;,
                      Body = &quot;Are you available for lunch tomorrow? A client would like to discuss a project with you.&quot;
                  },
                  new Email
                  {
                      From = &quot;Pete Davidson&quot;,
                      Body = &quot;Don't forget the kids have their soccer game this Friday. We have to supply end of game snacks.&quot;
                  },
                  new Email
                  {
                      From = &quot;OneDrive&quot;,
                      Body = &quot;Your new album.\r\nYou uploaded some photos to yuor OneDrive and automatically created an album for you.&quot;
                  },
                  new Email
                  {
                      From = &quot;Twitter&quot;,
                      Body = &quot;Here are some people we think you might like to follow:\r\n.@randomPerson\r\nAPersonYouMightKnow&quot;
                  }
              };
  
              return MyEmails;
          }
      }
  </code></pre>
  <p><em>Current result</em></p>
  <p><a href="https://i.stack.imgur.com/dBLQE.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/dBLQE.png" alt="Blank Master Details View" /></a></p>
  <p><a href="https://i.stack.imgur.com/0aXw7.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/0aXw7.png" alt="enter image description here" /></a></p>
  <p><a href="https://i.stack.imgur.com/00rB6.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/00rB6.png" alt="enter image description here" /></a></p>