MaterialDesignInXAML / MaterialDesignInXamlToolkit

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

DrawerHost crash when there's a textbox inside #1735

Closed vandrerm closed 4 years ago

vandrerm commented 4 years ago

DrawerHost crash when there's a textbox inside. Problem happens only in version 3.1.0 of MaterialDesignThemes. I use Visual Studio and NuGet, .net framework 4.8

Keboo commented 4 years ago

Can you provide more details or a reproduction project? The demo app uses a drawerhost with several text boxes inside of it.

vandrerm commented 4 years ago

Basically the error is the textbox within a usercontrol. This usercontrol is within a contentcontrol. The contentcontrol is inside a materialDesign:DrawerHost. The materialDesign:DrawerHost is inside a page.

Here is the piece of code.

-------page

----------usercontrol Vandré Medina - Desenvolvimento Web On Mon, Apr 13, 2020 at 12:14 PM Kevin B wrote: > Can you provide more details or a reproduction project? The demo app uses > a drawerhost with several text boxes inside of it. > > — > You are receiving this because you authored the thread. > Reply to this email directly, view it on GitHub > , > or unsubscribe > > . >
sa68ru commented 4 years ago

@Keboo this happens if the textbox does not contain TextFieldAssist.HasOutlinedTextField = "True".

Keboo commented 4 years ago

I am not able to replicate the crash, but I am able to cause the UI to hang and become unresponsive with:

<Window x:Class="WpfApp1.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:WpfApp1"
        xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
        mc:Ignorable="d"
        Title="MainWindow" Height="450" Width="800">
    <materialDesign:DrawerHost>
        <materialDesign:DrawerHost.RightDrawerContent>
            <Grid Background="Azure" MinWidth="200">
                <!-- Works -->
                <TextBox materialDesign:TextFieldAssist.HasOutlinedTextField="True"/>
                <!-- Causes the UI to hang -->
                <!--<TextBox />-->
            </Grid>
        </materialDesign:DrawerHost.RightDrawerContent>

        <Button Width="100" HorizontalAlignment="Center" VerticalAlignment="Center" Content="Open"
                Command="{x:Static materialDesign:DrawerHost.OpenDrawerCommand}" CommandParameter="{x:Static Dock.Right}" />
    </materialDesign:DrawerHost>
</Window>
sa68ru commented 4 years ago

This causes a large load on the CPU.

<Window x:Class="Test.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:m="http://materialdesigninxaml.net/winfx/xaml/themes"
        xmlns:local="clr-namespace:Test"
        mc:Ignorable="d"
        Title="MainWindow" Height="450" Width="800">
    <m:DialogHost>
        <m:DrawerHost>
            <m:DrawerHost.LeftDrawerContent>
                <StackPanel MinWidth="200">
                    <TextBox m:HintAssist.Hint="Test"/>
                </StackPanel>
            </m:DrawerHost.LeftDrawerContent>
        </m:DrawerHost>
    </m:DialogHost>
</Window>
vandrerm commented 4 years ago

Hello. I created sample code. In this example, the software almost crashes, but it seems to be absurdly slow and windows puts the status as "not responding". In the complete source it freezes, and the mouse cursor disappears. Synonymous with a "not responding" program.

In the code, if you comment on the textbox inside usercontrol1 and uncomment the button, you'll see that the problem is over.

I hope that now it becomes easier to solve the problem.

thankful WpfApp6.zip https://drive.google.com/file/d/1m3aWjANM09Fwp3dfTL-aqcl4jTHRUfef/view?usp=drive_web

Vandré Medina - Desenvolvimento Web

On Mon, Apr 20, 2020 at 3:43 AM sa68ru notifications@github.com wrote:

This causes a large load on the CPU.

<Window x:Class="Test.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:m="http://materialdesigninxaml.net/winfx/xaml/themes" xmlns:local="clr-namespace:Test" mc:Ignorable="d" Title="MainWindow" Height="450" Width="800">

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub , or unsubscribe .