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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T09:10:53+00:00 2026-05-16T09:10:53+00:00

Hallo Stackoverflow fellas! In my recent wpf application building I ancountered a strange behaviour:

  • 0

Hallo Stackoverflow fellas!

In my recent wpf application building I ancountered a strange behaviour:

When I set the Template of the Window class in my application every Validation.ErrorTemplate doesn’t appear anymore.

So in my App.xaml I have defined the following:

<Application.Resources>
    <Style TargetType="{x:Type TextBox}">
        <Setter Property="Background" Value="WhiteSmoke"/>
        <Setter Property="Validation.ErrorTemplate">
            <Setter.Value>
                <ControlTemplate>
                    <DockPanel LastChildFill="True">
                        <TextBlock DockPanel.Dock="Right" Foreground="Red" FontSize="12">*</TextBlock>
                        <Border BorderBrush="Red" BorderThickness="2" CornerRadius="3">
                            <AdornedElementPlaceholder />
                        </Border>
                    </DockPanel>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
        <Style.Triggers>
            <Trigger Property="Validation.HasError" Value="true">
                <Setter Property="ToolTip" Value="{Binding RelativeSource={RelativeSource Self}, Path=(Validation.Errors)[0].ErrorContent}"/>
            </Trigger>
        </Style.Triggers>
    </Style>

    <Style x:Key="PlainStyle" TargetType="{x:Type l:MainWindow}">
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type l:MainWindow}">
                    <ContentPresenter Content="{TemplateBinding Content}"/>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>        
</Application.Resources>

In my Window I defined the following:

<Window x:Class="ModelItemTest.MainWindow"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    Title="MainWindow" 
    Height="600" 
    Width="800" 
    Style="{StaticResource PlainStyle}">
<TextBox x:Name="Testbox" Text="{Binding Path=TestPerson.Name, ValidatesOnDataErrors=True, UpdateSourceTrigger=PropertyChanged}" VerticalAlignment="Center" HorizontalAlignment="Center" Width="100"/>

The class I bound the TextBox to looks like this:

public class Person : IDataErrorInfo
{
    private string _name;

    public string Name { get { return _name; } set { _name = value; } }

    public string this[string columnName]
    {
        get
        {
            if (columnName.Equals("Name") && !Name.Equals("Martin"))
                return "The Value is invalid!!!";
            return string.Empty;
        }
    }

    public string Error
    {
        get { return string.Empty; }
    }
}

Now surprisingly the tooltip of the error shows up when the name is invalid but the error template stays hidden. Can anybody tell what is the reason for that or if there is a work around for that.

  • 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-16T09:10:54+00:00Added an answer on May 16, 2026 at 9:10 am

    You have removed the AdornerDecorator from the default Window template, so there is no AdorderLayer to render the error adorner. Try adding one to your ControlTemplate:

    <ControlTemplate TargetType="{x:Type l:MainWindow}">
        <AdornerDecorator>
            <ContentPresenter Content="{TemplateBinding Content}"/>
        </AdornerDecorator>
    </ControlTemplate>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Hello, stackoverflow community! I am working on a rather large database-driven web application. The
Hello stackoverflow fellow members? Struct Declaration in class A struct PointSprite { GLfloat x;
Hello fellow StackOverflow users (or Stackoverflowers ?): I'm learning-by-coding WPF. I read several articles/saw
Hallo Dear Stackoverflow users. Working with sql on sql server I have searched the
Hello stackoverflow community, I have some code that works on virtually every browser except
Hello StackOverflow users. I am trying to create an application where you can browse
Hello stackoverflow people! I've got a problem which I haven't been able to solve
Hello StackOverflow community! I started to learn Node.js recently, and decided to implement a
Hello StackOverflow :) I have created some code inside my onStart(); method to ensure
Hello stackoverflow community ! I am trying to figure out how to architect my

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.