title: How to load external font file in WPF on runtime
body: <p>This question has already been asked and I've tried every given solution but yet it's not working for me.
  I have a TTF file somewhere on my hard disk and I try to load and use it when a button is clicked without the use of <code>XAML</code>. It's totally dynamic so I don't want to get involved with resources.</p>
  
  <p>Here's my code:</p>
  
  <pre><code>var path = @"D:\Fonts\Ashley.ttf";
  btn.FontFamily = new FontFamily(new Uri(path), "Ashley");
  </code></pre>
  
  <p>But it doesn't work. Can you give me a working solution?</p>