How to let a window use default style but not the UI framework (Lepoco WPFUI) style in WPF?

  Kiến thức lập trình

Recently, I added Lepoco WPFUI UI framework to my project, but I have one window that I want it to use the default style. In this case, I tried some ways but they did not work.

Here is my App.xaml:

<Application x:Class="Client_Window.App"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             StartupUri="MainWindow.xaml"
             xmlns:ui="http://schemas.lepo.co/wpfui/2022/xaml"
             >
    <Application.Resources>
        <ResourceDictionary>
            <ResourceDictionary.MergedDictionaries>
                    <ui:ThemesDictionary Theme="Dark" />
                    <ui:ControlsDictionary />
                </ResourceDictionary.MergedDictionaries>
                <!--ResourceDictionary.MergedDictionaries>
                <ResourceDictionary Source="pack://application:,,,/HandyControl;component/Themes/SkinDefault.xaml" />
                <ResourceDictionary Source="pack://application:,,,/HandyControl;component/Themes/Theme.xaml" />
            </ResourceDictionary.MergedDictionaries-->
        </ResourceDictionary>
    </Application.Resources>
</Application>

I tried the following:

Override the style of the window:

<Window x:Class="Client_Window.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:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
        xmlns:local="clr-namespace:Client_Window"
        mc:Ignorable="d"
        Title="Login" Height="200" Width="400" ResizeMode="NoResize" Initialized="Window_Initialized">
    <Window.Resources>
        <!-- No merged dictionaries or different theme resources here -->
    </Window.Resources>
...

Set style to null:

I also tried to add Style="{x:Null}" to the <Window>.

Besides, I found some related problems like this one (Default WPF Styles with local Styles), but none of them can answer my question.

In this case, I am looking for a way to let a specific window not use the default style.

Theme wordpress giá rẻ Theme wordpress giá rẻ Thiết kế website

LEAVE A COMMENT