61

I just try to view the result after XAML code in Designer. However, it's hard to recognize the black letters when I use a dark theme in vs2012.

My question is how to change designer background to white color without modifying the dark theme. Seems to change several options in tools?

Thanks


Please skim over all the answers. All have different approaches and it may be that the later ones will suit your needs better.

jumbo
  • 4,670
  • 5
  • 39
  • 44
Ted Corleone
  • 843
  • 1
  • 8
  • 16

4 Answers4

102

In VS 2013 you can change XAML designer background. Go to:

Tools -> Options -> Environment -> Fonts and Colors

In the combobox at the top of the panel, select:

Show settings for: XAML UI Designer

Then set:

Item foreground : white
Item background : white or very light grey (custom)
Stealth Rabbi
  • 10,156
  • 22
  • 100
  • 176
VisualStudioEspresso
  • 1,099
  • 1
  • 8
  • 3
41

As of Visual Studio 2017 the XAML designer has a "Toggle artboard background" button, which has the effect of changing the transparent from a black checkerboard to a white checkerboard.

The benefit of this is there is no need to modify your XAML files.

Image showing where the Toggle artboard background is in Visual Studio 2017 XAML designer

Jack Ukleja
  • 13,061
  • 11
  • 72
  • 113
34

Alternate approach that doesn't involve code:

  1. Install the "Visual Studio Color Theme Editor" Extension

  1. Create a new custom theme based on the one you want to modify. (2013-specific help image below) 2013 Copy Theme Icon

  2. Click the "Show All Elements" filter button in the upper-left of the theme editor Show All Elements button

  3. Type "artboard" in the search-box in the upper-right of the theme editor Search Box

  4. Set the "Cider -> ArtboardBackground" color to a different color of your choice.

  • VS2013 also introduces a second value "Cider -> ArtboardSecondaryBackground" to create a helpful checker-boarding effect.
  1. Yay! :D

Note: The "Cider -> ArtboardBackground" color theme field is found in VS2012 but I cannot confirm whether it has the same name in VS2010.

Edits: Added link to VS2013 (thank you @treaschf for the note!) official extension, although I think its an "RC" version. Also, added handy pictures.

Benjamin Buch
  • 4,752
  • 7
  • 28
  • 51
MechEthan
  • 5,703
  • 1
  • 35
  • 30
  • Please don't post exactly the same answer to several questions. If the same answer applies to more than one question it's a good sign the questions are duplicate. You should be flagging (or closing if you have enough reputation), not answering. – ChrisF Mar 13 '13 at 22:45
  • 1
    Apparently this extension includes "Light With Dark Editor" theme. Just what I was looking for. Also fixes the dark designer background problem. – michaelr524 Oct 06 '13 at 07:46
  • 2
    Note that `Cider` is the WPF XAML Designer and that the `XAML UI Designer` is the xaml designer for all other xaml platforms. You might have to update both if you use both technologies. – Owen Johnson Jul 22 '15 at 16:01
29

I've had the same problem and came across a very useful blog post which details how to use a trigger for a style in the App.xaml

<Style TargetType="{x:Type UserControl}">
    <Style.Triggers>
        <Trigger Property="ComponentModel:DesignerProperties.IsInDesignMode"
                 Value="true">
            <Setter Property="Background"
                    Value="White" />
        </Trigger>
    </Style.Triggers>
</Style>

http://caraulean.com/2012/visual-studio-2012-dark-theme-tip/

Abbas
  • 3,872
  • 6
  • 36
  • 63
Antony Scott
  • 21,690
  • 12
  • 62
  • 94
  • It's pretty good to use a trigger in App.xaml and seems no other methods here. Hope that it could be fixed in next version by Microsoft. Dark theme is really cool actually. Thanks for your share. – Ted Corleone Jan 12 '13 at 04:32
  • 7
    XMLNS xmlns:ComponentModel="clr-namespace:System.ComponentModel;assembly=PresentationFramework" – Evalds Urtans Apr 29 '14 at 08:22
  • For this style to work, it needs to be wrapped in a tag ``, and placed just below the `` tag. – Contango Mar 17 '16 at 14:33
  • As an aside, this tag is only relevant to a `UserControl`, as a `ResourceDictionary` does not support XAML preview. – Contango Mar 17 '16 at 14:36