wpfui icon indicating copy to clipboard operation
wpfui copied to clipboard

Visual studio's Editor not showing controls correctly when using the WPF UI library in an existing project

Open yesseruser opened this issue 1 year ago • 6 comments

Describe the bug

After downloading the NuGet package into an existing WPF project, Visual Studio's built-in Editor only seems to show ui:Buttons with the "Appearance" property set to "Primary". All other controls are invisible (see screenshot).

Here's my App.xaml file:

<Application x:Class="Kviz.App"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:local="clr-namespace:Kviz"
             xmlns:ui="http://schemas.lepo.co/wpfui/2022/xaml"
             StartupUri="Form1.xaml">
    <Application.Resources>
        <ResourceDictionary>
            <ResourceDictionary.MergedDictionaries>
                <ui:ThemesDictionary Theme="Dark" />
                <ui:ControlsDictionary />
            </ResourceDictionary.MergedDictionaries>
        </ResourceDictionary>
    </Application.Resources>
</Application>

To Reproduce

  1. Create a new standard WPF project.
  2. Add the WPF-UI NuGet package to it.
  3. Add controls to a page or window.
  4. Observe the issue.

Expected behavior

The editor should either:

  • Show dark mode and all controls white, or
  • Show normal light mode and all controls black.

Screenshots

image

OS version

Windows 11 Pro 22H2 (Build 22621.1992) - AMD64

.NET version

.NET 7.0.306

WPF-UI NuGet version

WPF UI 2.0.3

Additional context

Visual Studio 2022 version: 17.6.5

yesseruser avatar Jul 16 '23 06:07 yesseruser

i have the same issue, the designer is still showing plain WPF elements

Edit: I was using VS2019, and this was resolved after updating to VS2022

senyangjiang avatar Jul 17 '23 16:07 senyangjiang

For me the designer is showing no elements at all unless I set the appearance property to Primary, and that is only possible on some elements

yesseruser avatar Aug 03 '23 07:08 yesseruser

Hey there @yesseruser, did you ever manage to resolve that problem? I'm facing the same issue...

robng avatar Jan 04 '24 17:01 robng

This occurs because you are using Dark controls on the light background in preview.

To allow displaying proper preview on a black background, add a Background or ui:Design.Background to your control.

https://github.com/lepoco/wpfui/blob/7fcc2d8410f056d1d6de97c2f8078b3d8b38539b/src/Wpf.Ui.Gallery/Views/Windows/MainWindow.xaml#L19C5-L19C5

pomianowski avatar Jan 04 '24 21:01 pomianowski

Thanks a lot @pomianowski, that makes embarrassingly much sense... and sure enough, that fixed it.

robng avatar Jan 04 '24 21:01 robng

https://github.com/lepoco/wpfui/blob/7fcc2d8410f056d1d6de97c2f8078b3d8b38539b/src/Wpf.Ui.Gallery/Views/Windows/MainWindow.xaml#L19C5-L19C5

https://github.com/lepoco/wpfui/blob/7fcc2d8410f056d1d6de97c2f8078b3d8b38539b/src%2FWpf.Ui.Gallery%2FViews%2FWindows%2FMainWindow.xaml#L19 ( ui:Design.Background="{DynamicResource ApplicationBackgroundBrush}")

Does {DynamicResource ApplicationBackgroundBrush} auto update based on user's color scheme?

yesseruser avatar Jan 06 '24 13:01 yesseruser

@robng Please close this issue.

m0lDaViA avatar May 10 '24 01:05 m0lDaViA