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 6118213
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T15:24:37+00:00 2026-05-23T15:24:37+00:00

Dear honorable people of stackoverflow, why is my textbox, which is my validated control,

  • 0

Dear honorable people of stackoverflow, why is my textbox, which is my validated control, hidden behind the DockPanel Background in this template?

    <ControlTemplate x:Key="validationTemplate">
        <DockPanel Background="Black">
            <TextBlock Foreground="Red" FontSize="20">!</TextBlock>
            <AdornedElementPlaceholder/>
        </DockPanel>
    </ControlTemplate>

If the Background is set to “Transparent” the Textbox is visible but i´m not able to click inside (cursor won´t change).

How can i set a Background for my template without hiding my AdorendElementPlaceholder?

thanks gpx

  • 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-23T15:24:37+00:00Added an answer on May 23, 2026 at 3:24 pm

    The adorner layer does sit on top of the element, and can intercept mouse interactions. In your case, by applying a background to the DockPanel, you’re indicating to WPF that the object has area that is “HitTestVisible” and will intercept mouse clicks.

    Another confusing note is that “Transparent” is still HitTestVisible. If you don’t want it to intercept mouse clicks, then you should set the background to “{x:Null}” or leave it blank.

    Two options:

    1. Set the Background=”{x:Null}”. This is basically no background and prevent mouse hit tests.
    2. Specify IsHitTestVisible=”False” on the DockPanel. This will allow mouse interactions to bypass that layer and go to the next available layer.

    EDIT:

    Here’s an example that works for me in KaXaml. Just type something like “word” in the textboxes to generate a validation error. By setting the background color to a semi-transparent color, I’m able to see the textbox. Setting IsHitTestVisible=”False” allows me to click into the textbox with my mouse.

    <Page
      xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
      xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
      <Page.Resources>
        <ControlTemplate x:Key="validationTemplate">
            <DockPanel Background="#5000" IsHitTestVisible="False">
                <TextBlock Foreground="Red" FontSize="20">!</TextBlock>
                <AdornedElementPlaceholder/>
            </DockPanel>
        </ControlTemplate>
        <Style TargetType="TextBox" x:Key="validationStyle">
          <Style.Triggers>
            <Trigger Property="Validation.HasError" Value="True">
              <Setter Property="Background" Value="Green" />
            </Trigger>
          </Style.Triggers>
        </Style>
      </Page.Resources>
      <StackPanel Name="grd" Width="100" Height="100">  
        <TextBox 
            VerticalAlignment="Top"
            Validation.ErrorTemplate="{StaticResource validationTemplate}"
            Text="{Binding ElementName=grd, Path=Width, Mode=TwoWay, ValidatesOnExceptions=True}" />
        <TextBox 
            VerticalAlignment="Top"
            Text="{Binding ElementName=grd, Path=Height, Mode=TwoWay, ValidatesOnExceptions=True}"
            Style="{StaticResource validationStyle}"
            >
        </TextBox>
      </StackPanel>
    </Page>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Dear visitors stackoverflow! I can not solve a simple problem: Body given the background
dear all.. i have a DB which built use Mysql. for this case, i
Dear all,Now i have this question in my java program,I think it should be
Dear members of the Stackoverflow community, We are developing a web application using the
Dear stackoveflow, I have this problem. I'm working with an old version of mssql
dear all..i have this code: <script> var str=KD-R435MUN2D; var matches=str.match(/(EE|[EJU]).*(D)/i); if (matches) { var
Dear LINQ or linq2sql experts, can you help me to solve this case? I
Dear Friends good afternoon. My problem may be this is very basic one i.e.
Hi again dear comminity! To make it short, I have a textbox, where you
Dear friends,I want to extract text 平均3.6 星 from this code segment excerpted from

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.