title: Windows 8 metro call standardstyle from code behind
body: <p>I am trying to assign a style defined in StandardStyles.xaml through code behind.</p>
  
  <p>I tried </p>
  
  <pre><code>var x = Resources["UnfavoriteAppBarButtonStyle"];
  </code></pre>
  
  <p>but I get <strong>COMException</strong> on that code.</p>
  
  <p><strong>Error HRESULT E_FAIL has been returned from a call to a COM component.</strong></p>
  
  <p>If above code is wrong than how can I access styles from StandardStyles.xaml</p>