Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

hc:TextBox BorderBrush not work when validation error #202

Closed
CodingOctocat opened this issue May 25, 2023 · 2 comments
Closed

hc:TextBox BorderBrush not work when validation error #202

CodingOctocat opened this issue May 25, 2023 · 2 comments

Comments

@CodingOctocat
Copy link

CodingOctocat commented May 25, 2023

Describe the bug

I don't want the error message text, just the red outer box, so I set the error template to null:

<Style BasedOn="{StaticResource TextBoxPlusBaseStyle}"
       TargetType="{x:Type hc:TextBox}">
    <Setter Property="Validation.ErrorTemplate" Value="{x:Null}" />
</Style>

HandyControl is as expected, but the HandyControls Border does not turn red brush.

NuGet package version

HandyControls (Custom version) 3.4.5

IDE

Visual Studio 2022

Framework type

.Net 7.0

Windows version

Windows 11 (22621)

Additional context

No response

@ghost1372
Copy link
Owner

report it in original repo

@CodingOctocat
Copy link
Author

I found the solution:

<Style x:Key="MyTextBoxStyle"
        BasedOn="{StaticResource TextBoxPlusBaseStyle}"
        TargetType="{x:Type hc:TextBox}">
    <Setter Property="ToolTip" Value="{Binding Text, RelativeSource={RelativeSource Self}}" />
    <!--  Hide the validation error message, this solution does not work for ComboBox.  -->
    <Setter Property="Validation.ErrorTemplate" Value="{x:Null}" />
    <Setter Property="b:TripleClickToSelectAllBehavior.Enabled" Value="True" />
    <Setter Property="hc:InfoElement.ShowClearButton" Value="{Binding IsReadOnly, Converter={StaticResource Boolean2BooleanReConverter}, RelativeSource={RelativeSource Mode=Self}}" />
    <Setter Property="hc:TitleElement.TitlePlacement" Value="Left" />


    <Style.Triggers>
        <Trigger Property="Validation.HasError" Value="True">
            <Setter Property="ToolTip" Value="{Binding (Validation.Errors), RelativeSource={RelativeSource Self}, Converter={StaticResource ValidationErrorsToolTipConverter}}" />
        </Trigger>
    </Style.Triggers>
</Style>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants