title: WPF and custom rendering
body: <p>I'm trying a very simple example in F# and WPF. I want to override OnRender on Canvas.
  I did this :</p>
  
  <pre><code>namespace App
  
  open ...
  
  type public MyRender =
    class
      inherit FrameworkElement
  
      new() = { inherit FrameworkElement() }
  
      override this.OnRender(dc:DrawingContext) =
        dc.DrawRectangle(Brushes.DarkGray, null, new Rect(0.0, 0.0, 200.0, 80.0))
        let text = new FormattedText("Hello World!", 
                                     CultureInfo.CurrentUICulture,
                                     FlowDirection.LeftToRight,
                                     new Typeface("Tahoma"), 20.0, Brushes.White)
        dc.DrawText(text, new Point(30.0, 25.0))
        dc.DrawEllipse(new SolidColorBrush(Colors.Black), 
                       new Pen(Brushes.Blue, 10.0), 
                       new Point(256.0, 256.0), 80.0, 30.0)
        base.OnRender(dc)
    end
  
  module Main = 
    type MainWindow = XAML&lt;"MainWindow.xaml"&gt;
    let loadWindow() =
      let window = MainWindow()
      window.Root
  
    [&lt;;STAThread&gt;;]
    (new Application()).Run(loadWindow()) |&gt; ignore
  </code></pre>
  
  <p>And in the XAML file :</p>
  
  <pre><code>&lt;Window x:Class="System.Windows.Window"
          xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
          xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
          xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
          xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
                mc:Ignorable="d"
          xmlns:wf="clr-namespace:App"
          Title="" Height="450" Width="500"&gt;
          &lt;Canvas Height="400" Width="400"&gt;
          &lt;wf:MyRender Width="300" Height="300"/&gt;
          &lt;/Canvas&gt;
  &lt;/Window&gt;
  </code></pre>
  
  <p>The name of the application is App.fs.
  XAML keeps telling me MyRender is not found in App namespace. I can't uderstand why or what I can do to fix it. Could someone enlighten me ?</p>
  
  <p>Thanks in advance.</p>
  
  <p>[Edit] I have edited the code using the suggestion by <a href="https://stackoverflow.com/users/33518/tomas-petricek">Tomas Petricek</a>. I have also moved MyRender to inherit from FrameworkElement and put it into a Canvas. Now, the XAML Window in VS2013 shows the MyRender element. However I still get the run time exception about being unable to create the unkown type '{clr-namespace:App}MyRender'.</p>
  
  <p>The problem seems to be now that I need to point the ws: namespace to the current assembly. 
  Any idea on how to do that?</p>