lepoco / wpfui

WPF UI provides the Fluent experience in your known and loved WPF framework. Intuitive design, themes, navigation and new immersive controls. All natively and effortlessly.
https://wpfui.lepo.co
MIT License
7.42k stars 719 forks source link

Transparent Screen in Win11 + .NET 7 #854

Open Shahid-khan5 opened 9 months ago

Shahid-khan5 commented 9 months ago

Describe the bug

In a new project using .NET 7, the entire screen appears transparent. Although nothing is visible, you can still interact with the buttons defined in the window. image

To Reproduce

Create a new application WPF application and install latest WPF UI 3.0.0-preview.4

Expected behavior

It should show the default Home,Data and Setting pages

Screenshots

image

OS version

OS Name: Microsoft Windows 11 Pro Version: 10.0.21996 Build 21996 System Model: HP EliteBook 840 G7 Notebook PC

.NET version

.NET 7

WPF-UI NuGet version

3.0.0-preview.4

Additional context

I have created other applications using WPF UI; however, those applications also don't work, that works in win10

Shahid-khan5 commented 9 months ago

Upgraded the application to 3.0.0-preview.11 and still the same issue

Shahid-khan5 commented 9 months ago

I can see the application when I mouse over it in the task bar in release x64 mode. image

XzAeRo commented 9 months ago

This is odd. I created a demo app using the versions mentioned, but could not replicate. Are you sure you're not setting the window opacity to near zero levels?

Can you share a snippet of the <ui:FluentWindow> parameters?

Shahid-khan5 commented 9 months ago

I am not setting the opacity to zero. I have an application that I created a month ago, and it is production-ready. However, that doesn't work. When I drag the window and make it full screen, it shows. I have attached a video for you.

Main Window Code: <ui:FluentWindow x:Class="SplaatPhotoOrganizer.Views.Windows.MainWindow" 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:local="clr-namespace:SplaatPhotoOrganizer.Views.Windows" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:ui="http://schemas.lepo.co/wpfui/2022/xaml" Title="{Binding ViewModel.ApplicationTitle, Mode=OneWay}" Width="1100" Height="650" d:DataContext="{d:DesignInstance local:MainWindow, IsDesignTimeCreatable=True}" d:DesignHeight="450" d:DesignWidth="800" ui:Design.Background="{DynamicResource ApplicationBackgroundBrush}" ui:Design.Foreground="{DynamicResource TextFillColorPrimaryBrush}" ExtendsContentIntoTitleBar="True" Foreground="{DynamicResource TextFillColorPrimaryBrush}" WindowBackdropType="Mica" WindowCornerPreference="Round" WindowStartupLocation="CenterScreen" mc:Ignorable="d"> ... </ui:FluentWindow>

https://github.com/lepoco/wpfui/assets/76004649/7f9a4d49-f662-4692-8804-b76828f6c6ac

XzAeRo commented 9 months ago

This looks like the window is shrinking to width 0.

Are you handling window width or height somewhere in the code?

Also, try using debug mode for the builds, just in case to ignore any caching artifacts.

You can also try using Width="Auto" Height="Auto" SizeToContent="WidthAndHeight" in the ui:FluentWindow parameters, and see if it makes any change.

If nothing works, I suggest also checking out SnoopWPF: https://github.com/snoopwpf/snoopwpf

It's an utility to debug WPF apps, where you can also check stuff like window sizing and the source of the current values, which is massively useful in large applications.

Shahid-khan5 commented 9 months ago

Thank you for your insights! I appreciate your suggestions. I'll investigate the window sizing issue.

I'll check if window width or height is being handled in the code and make the necessary adjustments. I'll also try using debug mode for the builds and the parameters you suggested:

Width="Auto" Height="Auto" SizeToContent="WidthAndHeight"

If the issue persists, I'll definitely look into SnoopWPF as you recommended. It sounds like a valuable tool for debugging WPF applications.

I'll keep you posted on my progress and let you know if I have any questions.

Thanks again for your help!