title: Use DirectWrite from a C# XAML Metro-style app
body: <p>Could you provide some guidelines for how to use DirectWrite from a C# XAML-based Metro-style app. I want to create a XAML-based UI, but I also want to write custom text onto the screen effectively.</p>
  
  <p>My guess is that I can create a WinRT component in C++ which access DirectWrite directly, and use that component from the C# project. Is that possible?</p>
  
  <p>I tried to reference a Direct2D project from a C# XAML Metro application, but I couldn't even instantiate the class generated by the Direct2D template (it threw "A dynamic link library (DLL) initialization routine failed. (Exception from HRESULT: 0x8007045A)" exception).</p>
  
  <p>Then I tried to create a WinRT Component DLL project, and then copy paste the code files from the Direct2D project to that, but I wasn't able to get it compile.</p>
  
  <p>Are there fundamental differences between the Direct2D and the WinRT Component DLL project types? Can I access the classes from C# created in the earlier? Can I use Direct2D from the latter?</p>
  
  <p>UPDATE: I found a - somewhat disappointing - answer to a similar question (<a href="http://social.msdn.microsoft.com/Forums/en-ZA/winappswithcsharp/thread/2d7ab4a7-9248-426e-8b4d-644b451bef7a" rel="nofollow">http://social.msdn.microsoft.com/Forums/en-ZA/winappswithcsharp/thread/2d7ab4a7-9248-426e-8b4d-644b451bef7a</a>), but that was before the Consumer Preview. I hope the situation has changed since then.</p>