MaterialDesignInXAML / MaterialDesignInXamlToolkit

Google's Material Design in XAML & WPF, for C# & VB.Net.
http://materialdesigninxaml.net
MIT License
15.05k stars 3.41k forks source link

TextBoxes disappearing styles when in focus #3669

Open Ub4thaan opened 1 week ago

Ub4thaan commented 1 week ago

Bug explanation

I'm just starting out using this NuGet package (version 5.1.0) and my problem is that the search textbox looses any style when it has focus. For context this is my code:

App.xaml

<Application x:Class="LogistikiUI.App"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mdui="http://materialdesigninxaml.net/winfx/xaml/themes"
             xmlns:local="clr-namespace:LogistikiUI"
             StartupUri="MainWindow.xaml">
    <Application.Resources>
        <ResourceDictionary>
            <ResourceDictionary.MergedDictionaries>
                <ResourceDictionary Source="pack://application:,,,/MaterialDesignThemes.Wpf;component/Themes/MaterialDesignTheme.Dark.xaml" />
                <ResourceDictionary Source="pack://application:,,,/MaterialDesignThemes.Wpf;component/Themes/MaterialDesign3.Defaults.xaml" />
            </ResourceDictionary.MergedDictionaries>
        </ResourceDictionary>
    </Application.Resources>
</Application>

MainWindows.xaml

<Window x:Class="LogistikiUI.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:mdui="http://materialdesigninxaml.net/winfx/xaml/themes"
        xmlns:local="clr-namespace:LogistikiUI"
        mc:Ignorable="d"
        Title="MainWindow" Height="450" Width="800"
        WindowStartupLocation="CenterScreen"
        Style="{StaticResource MaterialDesignWindow}">
    <mdui:DrawerHost OpenMode="Modal" IsLeftDrawerOpen="True">
        <mdui:DrawerHost.LeftDrawerContent>
            <DockPanel Width="220">
                <DockPanel DockPanel.Dock="Top" Margin="10" LastChildFill="False">
                    <TextBlock DockPanel.Dock="Left" Margin="10,0" Style="{StaticResource MaterialDesignTitleLargeTextBlock}" Text="Logistiki" TextWrapping="Wrap" HorizontalAlignment="Center" VerticalAlignment="Center"/>
                    <Button DockPanel.Dock="Right" Foreground="{StaticResource MaterialDesign.Brush.Foreground}" Style="{StaticResource MaterialDesignIconForegroundButton}">
                        <mdui:PackIcon Kind="MenuOpen" />
                    </Button>
                </DockPanel>
                <TextBox Margin="10,5" Style="{StaticResource MaterialDesignOutlinedTextBox}" mdui:HintAssist.Hint="Search" mdui:TextFieldAssist.DecorationVisibility="Collapsed" mdui:TextFieldAssist.HasClearButton="True" mdui:TextFieldAssist.TextFieldCornerRadius="5" />
            </DockPanel>
        </mdui:DrawerHost.LeftDrawerContent>
    </mdui:DrawerHost>
</Window>

Since I'm starting new I have no clue if it's a bug or if it's a me problem, I also uploaded what the window looks like when I start the application. MainWindow1

Version

5.1.0

nicolaihenriksen commented 1 week ago

@Ub4thaan Are you missing a line like this in your App.xaml perhaps?

<materialDesign:BundledTheme BaseTheme="Light" PrimaryColor="DeepPurple" SecondaryColor="Lime" />

Then you're at least following more or less what the quick start guide is recommending.

Ub4thaan commented 1 week ago

Yeah, thought somehow that it would have some default colors as primary and secondary (which might be a great addition to it) My bad I guess should have paid more attention to the demo app, been finding out stuff as I go following the MaterialDesign3.Demo code. Thank you for your time and for the help.

nicolaihenriksen commented 1 week ago

@Ub4thaan No worries. Great that you got it solved (I assume you did, based on your comment). Can the issue be closed then? Or is there still something unclear?