Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6214249
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T06:50:36+00:00 2026-05-24T06:50:36+00:00

I have a user control that is binded to a view model and I

  • 0

I have a user control that is binded to a view model and I use IDataErrorInfo for validations with the default red border indication in case of validation errors.

Here is one of my controls:

<TextBox Text="{Binding Path=Code, ValidatesOnDataErrors=True}"></TextBox>

Everything works fine and during initialization all controls that have validation errors have this red border visible. All except the controls that are inside a TabItem control that is not visible (not selected) during initialization. These controls don’t display the red border although the validation runs fine also for them.

I isolated the problem and it is CLEARLY that the red border does not appear because the controls are not visible in the initial layout of the user control.

My question is do I miss something, and if not then how I can manually force validation for all my controls in the user control to run again so to display the red borders at least during TabControl.SelectionChanged?

Thank you in advance.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T06:50:37+00:00Added an answer on May 24, 2026 at 6:50 am

    I found a workaround

    I created a style where whenever IsVisible property of control is set to true I apply my own Validation.ErrorTemplate:

    <Style TargetType="{x:Type TextBox}">
                <Setter Property="ToolTip" Value="{Binding RelativeSource={x:Static RelativeSource.Self}, Path=(Validation.Errors)[0].ErrorContent}"></Setter>
                            <Style.Triggers>
                                        <Trigger Property="IsVisible" Value="True">
                        <Setter Property="Validation.ErrorTemplate">
                            <Setter.Value>
                                <ControlTemplate>
                                    <Border BorderBrush="Red" BorderThickness="1" >
                                        <AdornedElementPlaceholder/>
                                    </Border>
                                </ControlTemplate>
                            </Setter.Value>
                        </Setter>
                    </Trigger>
                </Style.Triggers>
            </Style>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a user control that contains a border somewhere in it. I am
I have a user control that is pretty basic. It contains several TextBox controls,
I have a user control that I'm building. It's purpose is to display the
i have a user control that descends from UserControl. When dropped onto the form
I have a user control that has a few public properties, one is an
I have a user control that I've created, however when I go to add
I have a user control that takes a several seconds to load. Is there
I have a user control that contains a collection of controls to be reused
I have a user control that contains a GridView. The GridView has both a
I currently have a user control that is used on both an /Address/Edit and

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.