FontButton Font change not working
<p>I'm using the following code to obtain the selected font from a FontButton. But the fontName doesn't change even if I choose a different font... the size works though.</p>

<pre><code>protected void OnFontbutton2FontSet (object sender, EventArgs e)
{
    try
    {
        string sfont = fontbutton2.FontName; 

        string fontName = sfont.Substring(0,sfont.LastIndexOf(' '));

        int fontSize = int.Parse(sfont.Substring(sfont.LastIndexOf(' ')+1).Trim());// I know, looks a bit ugly 
        cfont = new Font(fontName ,fontSize, FontStyle.Regular,System.Drawing.GraphicsUnit.Pixel);
            selectedfont=new Font(fontName ,fontSize, FontStyle.Regular,System.Drawing.GraphicsUnit.Pixel);
        MessageDialog md = new MessageDialog (this, DialogFlags.DestroyWithParent, MessageType.Info, ButtonsType.Close, fontName);
        int result = md.Run ();
        MessageDialog md2 = new MessageDialog (this, DialogFlags.DestroyWithParent, MessageType.Info, ButtonsType.Close, selectedfont.Name);
        int result2 = md2.Run ();
        if (wwork.IsBusy == false) {
            wwork.RunWorkerAsync ();
        } else {
            bgdirty = true; 
        }
    }
    catch(Exception ex) {
    }
}
</code></pre>

<p>But the newly created font <code>cfont</code> object stays as the default font, only the font size changes... font name does not change.</p>

<p>What am I doing wrong? Please advice.</p>

<p>UPDATE:
Console Output with Font Variable(font) Name Printed after setting </p>

<pre><code>System.Drawing.Font myfont = new Font ("Tahoma", 50, FontStyle.Regular, GraphicsUnit.Pixel);
</code></pre>

<hr>

<pre><code> Loaded assembly: /Users/me/Desktop/testproject/fonttest/fonttest/bin/Debug/fonttest.exe
    Loaded assembly: /Library/Frameworks/Mono.framework/Versions/4.2.1/lib/mono/gac/gtk-sharp/2.12.0.0__35e10195dab3c99f/gtk-sharp.dll [External]
    Loaded assembly: /Library/Frameworks/Mono.framework/Versions/4.2.1/lib/mono/gac/glib-sharp/2.12.0.0__35e10195dab3c99f/glib-sharp.dll [External]
    Loaded assembly: /Library/Frameworks/Mono.framework/Versions/4.2.1/lib/mono/gac/atk-sharp/2.12.0.0__35e10195dab3c99f/atk-sharp.dll [External]
    Loaded assembly: /Library/Frameworks/Mono.framework/Versions/4.2.1/lib/mono/gac/System/4.0.0.0__b77a5c561934e089/System.dll [External]
    Loaded assembly: /Library/Frameworks/Mono.framework/Versions/4.2.1/lib/mono/gac/gdk-sharp/2.12.0.0__35e10195dab3c99f/gdk-sharp.dll [External]
    Loaded assembly: /Library/Frameworks/Mono.framework/Versions/4.2.1/lib/mono/gac/Mono.Posix/4.0.0.0__0738eb9f132ed756/Mono.Posix.dll [External]
    Loaded assembly: /Library/Frameworks/Mono.framework/Versions/4.2.1/lib/mono/gac/System.Drawing/4.0.0.0__b03f5f7f11d50a3a/System.Drawing.dll [External]
    Fontconfig error: Cannot load default config file
    Lucida Grande
</code></pre>