title: Attach DataTemplate to Xamarin.Forms ShellContent
body: <p>I'm succesfully attaching a DataTemplate to my FlyoutItems and MenuItems in my Xamarin.Forms Shell App. However, how do I attach the same template to the ShellContent?</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;Shell xmlns="http://xamarin.com/schemas/2014/forms"
         xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
         xmlns:views="clr-namespace:MyApp.Views"
         xmlns:volDash="clr-namespace:MyApp.Views.VolDash"
         xmlns:orgDash="clr-namespace:MyApp.Views.OrgDash"
         x:Class="EventingVolunteers.AppShell"
         FlyoutBackgroundColor="#337ab7"&gt;
      &lt;Shell.Resources&gt;
          &lt;Style x:Key="FlyoutItemStyle" TargetType="Grid"&gt;
              &lt;Setter Property="VisualStateManager.VisualStateGroups"&gt;
                  &lt;VisualStateGroupList&gt;
                      &lt;VisualStateGroup x:Name="CommonStates"&gt;
                          &lt;VisualState x:Name="Normal" /&gt;
                          &lt;VisualState x:Name="Selected"&gt;
                              &lt;VisualState.Setters&gt;
                                  &lt;Setter Property="BackgroundColor" Value="Red"/&gt;
                              &lt;/VisualState.Setters&gt;
                          &lt;/VisualState&gt;
                          &lt;VisualState x:Name="Disabled"&gt;
                              &lt;VisualState.Setters&gt;
                                  &lt;Setter Property="BackgroundColor" Value="Green"/&gt;
                              &lt;/VisualState.Setters&gt;
                          &lt;/VisualState&gt;
                      &lt;/VisualStateGroup&gt;
                  &lt;/VisualStateGroupList&gt;
              &lt;/Setter&gt;
          &lt;/Style&gt;
          &lt;DataTemplate x:Key="FlyoutTemplates"&gt;
              &lt;Grid HeightRequest="{x:OnPlatform Android=50}" Style="{StaticResource FlyoutItemStyle}"&gt;
                  &lt;Grid.ColumnDefinitions&gt;
                      &lt;ColumnDefinition Width="{x:OnPlatform Android=54, iOS=50}"&gt;&lt;/ColumnDefinition&gt;
                      &lt;ColumnDefinition Width="*"&gt;&lt;/ColumnDefinition&gt;
                  &lt;/Grid.ColumnDefinitions&gt;
                  &lt;Image Source="{Binding FlyoutIcon}"
                      VerticalOptions="Center"
                      HorizontalOptions="Center"
                      HeightRequest="{x:OnPlatform Android=24, iOS=22}"
                      WidthRequest="{x:OnPlatform Android=24, iOS=22}"&gt;
                  &lt;/Image&gt;
                  &lt;Label VerticalOptions="Center"
                          Text="{Binding Title}"
                          FontSize="{x:OnPlatform Android=14, iOS=Small}"
                          FontAttributes="Bold" Grid.Column="1"&gt;
                      &lt;Label.TextColor&gt;
                          White
                      &lt;/Label.TextColor&gt;
                      &lt;Label.Margin&gt;
                          &lt;OnPlatform x:TypeArguments="Thickness"&gt;
                              &lt;OnPlatform.Platforms&gt;
                                  &lt;On Platform="Android" Value="20, 0, 0, 0" /&gt;
                              &lt;/OnPlatform.Platforms&gt;
                          &lt;/OnPlatform&gt;
                      &lt;/Label.Margin&gt;
                      &lt;Label.FontFamily&gt;
                          &lt;OnPlatform x:TypeArguments="x:String"&gt;
                              &lt;OnPlatform.Platforms&gt;
                                  &lt;On Platform="Android" Value="sans-serif-medium" /&gt;
                              &lt;/OnPlatform.Platforms&gt;
                          &lt;/OnPlatform&gt;
                      &lt;/Label.FontFamily&gt;
                  &lt;/Label&gt;
              &lt;/Grid&gt;
          &lt;/DataTemplate&gt;
      &lt;/Shell.Resources&gt;
      &lt;FlyoutItem
          x:Name="volFlyoutItem"
          Title="Volunteer Dashboard"
          FlyoutDisplayOptions="AsSingleItem"
          FlyoutIcon="ic_dashboard_white.png"
          Shell.ItemTemplate="{StaticResource FlyoutTemplates}"&gt;
          &lt;ShellContent Title="Signups" Icon="ic_assignment.png"&gt;
              &lt;volDash:SignupsPage /&gt;
          &lt;/ShellContent&gt;
          &lt;ShellContent Title="Events" Icon="ic_event.png"&gt;
              &lt;volDash:AreasPage /&gt;
          &lt;/ShellContent&gt;
          &lt;ShellContent Title="Mailbox" Icon="ic_mail_outline.png"&gt;
              &lt;volDash:MailboxPage /&gt;
          &lt;/ShellContent&gt;
          &lt;ShellContent Title="Rankings" Icon="fa_trophy.png"&gt;
              &lt;volDash:MyRankingsPage /&gt;
          &lt;/ShellContent&gt;
          &lt;ShellContent Title="Videos" Icon="ic_ondemand_video.png"&gt;
              &lt;volDash:TrainingVideoCategoriesPage /&gt;
          &lt;/ShellContent&gt;
      &lt;/FlyoutItem&gt;
      &lt;FlyoutItem
          x:Name="orgFlyoutItem"
          Title="Organizer Dashboard"
          FlyoutDisplayOptions="AsSingleItem"
          FlyoutIcon="ic_dashboard_white.png"
          IsEnabled="False"
          Shell.ItemTemplate="{StaticResource FlyoutTemplates}"&gt;
          &lt;ShellContent Title="Events" Icon="ic_event.png"&gt;
              &lt;orgDash:EventsPage /&gt;
          &lt;/ShellContent&gt;
      &lt;/FlyoutItem&gt;
      &lt;ShellContent
          Title="Account"
          Icon="ic_account_box_white.png"
          Shell.ItemTemplate="{StaticResource FlyoutTemplates}"
          Shell.MenuItemTemplate="{StaticResource FlyoutTemplates}"&gt;
          &lt;views:AccountPage /&gt;
      &lt;/ShellContent&gt;
      &lt;MenuItem
          Shell.MenuItemTemplate="{StaticResource FlyoutTemplates}"
          Text="Logout"
          Icon="ic_dashboard_white.png"
          Command="{Binding LogOutCommand}" /&gt;
  &lt;/Shell&gt;
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/WInCu.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/WInCu.png" alt="enter image description here"></a></p>