Default Visual Studio 2010 WPF / Silverlight Project

Is there a way to change the default background of a WPF / Silverlight (Cider) designer? Or maybe some kind of "IsInDesignMode" / fatal hack for this.

The problem is that I have transparent backgrounds in user controls, my texts are mostly white (my shell is dark). And I do not see them in the designer.

+5
source share
1 answer

. First you must create an IsDesignMode for yourself:

static public class ApplicationExtensions
{
    public static bool IsDesignMode(this Application app)
    {
        return System.ComponentModel.DesignerProperties.GetIsInDesignMode(app.RootVisual);
    }
}

Now, in your control constructor, after calling InitalizeComponents, try something like:

if (Application.IsDesignMode)
   LayoutRoot.Background = Colors.Black; // Or whatever control
+2
source

All Articles