title: Xamarin.Forms Load XAML View at Run time
body: <p>I'm looking for a solution to dynamically load a XAML file at Run time in Xamarin.Forms so it can then be displayed as a View / ContentPage.</p>
  
  <p>I've already found some answers to this problem but they do not work anymore or the samples are deleted:</p>
  
  <p><a href="https://stackoverflow.com/questions/37255023/xamarin-forms-dynamically-load-a-page">Xamarin forms.Dynamically load a page</a></p>
  
  <p><a href="https://forums.xamarin.com/discussion/87727/load-xaml-dynamically-at-runtime" rel="nofollow noreferrer">https://forums.xamarin.com/discussion/87727/load-xaml-dynamically-at-runtime</a></p>
  
  <p>XAML example to load:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8" ?&gt;
  &lt;ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
               xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
               x:Class="Examples.Views.TestView"&gt;
      &lt;ContentPage.Resources&gt;
          &lt;ResourceDictionary&gt;
              &lt;Style TargetType="Label"&gt;
                  &lt;Setter Property="FontSize" Value="Medium" /&gt;
                  &lt;Setter Property="TextColor" Value="Black"/&gt;
              &lt;/Style&gt;
          &lt;/ResourceDictionary&gt;
      &lt;/ContentPage.Resources&gt;
      &lt;ContentPage.Content&gt;
          &lt;StackLayout&gt;
              &lt;Label Text="Hello World!"&gt;&lt;/Label&gt;
          &lt;/StackLayout&gt;
      &lt;/ContentPage.Content&gt;
  &lt;/ContentPage&gt;
  </code></pre>