MaterialDesignInXAML / MaterialDesignInXAML/MaterialDesignInXamlToolkit

ValidationAssist.Suppress does not affect textbox underline

Open
#892 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug up-for-grabs
Dominant language
C#
Stars
16.3k
Forks
3.5k
Avg merge
1d 22h
Merged PRs (30d)
8

Description

I am using the following style to suppress validation on disabled textboxes.

    <Style x:Key="DefaultTextBox" TargetType="{x:Type TextBox}" BasedOn="{StaticResource MaterialDesignTextBox}">
        <Style.Triggers>
            <!-- Remove the errors when the control is disabled. -->
            <Trigger Property="IsEnabled" Value="False">
                <Setter Property="materialDesign:ValidationAssist.Suppress" Value="True"/>
                <!--<Setter Property="BorderBrush" Value="{StaticResource MaterialDesignTextBoxBorder}"/>-->
            </Trigger>
        </Style.Triggers>
    </Style>

Here is the result of that:

image

The red underline is still applied to the disabled textbox. The Error text is correctly hidden.

I worked around this by using the commented out setter for the BorderBrush. This is mostly just to make the behavior consistent with other controls. The Combobox does not require the workaround. I haven't tested any other controls either so it may be worth checking each one.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the supplied XAML style with a disabled TextBox that has a validation error, then compare its validation styling with the ComboBox behavior. Trace the TextBox validation template or styling and verify that suppressing validation also removes the red underline while preserving the hidden error text.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
desktop
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.