title: Binding to StaticResource with a property of View Model in Xamarin.Forms?
body: <p>I have some custom fonts defined in ResourceDictionary</p>
  
  <pre><code>&lt;Application xmlns="http://xamarin.com/schemas/2014/forms"
           xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
           x:Class="Fonlow.VA.App"&gt;
  &lt;Application.Resources&gt;
      &lt;ResourceDictionary&gt;
          &lt;OnPlatform x:TypeArguments="x:String" x:Key="SuperFont"&gt;
              &lt;On Platform="Android" Value="Super.ttf#Super" /&gt;
              &lt;On Platform="UWP" Value="/Assets/Super.ttf#Super" /&gt;
              &lt;!--&lt;On Platform="iOS" Value="OpenSans-Bold" /&gt;--&gt;
          &lt;/OnPlatform&gt;
          &lt;OnPlatform x:TypeArguments="x:String" x:Key="NormalFont"&gt;
              &lt;On Platform="Android" Value="Normal.ttf#Normal" /&gt;
              &lt;On Platform="UWP" Value="/Assets/Normal.ttf#Normal" /&gt;
              &lt;!--&lt;On Platform="iOS" Value="OpenSans-Bold" /&gt;--&gt;
          &lt;/OnPlatform&gt;
      &lt;/ResourceDictionary&gt;
  &lt;/Application.Resources&gt;
  </code></pre>
  
  <p></p>
  
  <p>And</p>
  
  <pre><code>  &lt;Label Text="{Binding CurrentOptotype.Text}" FontFamily="{StaticResource SuperFont}" FontSize="{Binding CurrentFontSize}" TextColor="Black" /&gt;
  </code></pre>
  
  <p>So far so good. However, I would switch the FontFamily at runtime through ViewModel binding just like the binding for FontSize, since CurrentFontSize is a property in the View Model.
  I had tried:</p>
  
  <pre><code>FontFamily="{Binding CurrentFontFamily}"
  </code></pre>
  
  <p>And the value of CurrentFontFamily can point to an existing system font, but I want to point to a custom font pointing to what defined in ResourceDictionary.</p>
  
  <p>I had then tried:</p>
  
  <pre><code>FontFamily="{StaticResource {Binding CurrentFontFamily}}"
  </code></pre>
  
  <p>And there's runtime error obviously against such makeup syntax. I just wonder whether there's a in XAML to switch custom font at runtime through MVVM View Model?</p>