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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 10, 20262026-05-10T14:46:57+00:00 2026-05-10T14:46:57+00:00

In WPF, is it possible for a DataTrigger to bind to an attached property?

  • 0

In WPF, is it possible for a DataTrigger to bind to an attached property?

I essentially want to use a converter on an attached property to provide a style when a particular validation rule has been broken. I am using markup like the following:

<DataTrigger Binding='{Binding Path=Validation.Errors,                         RelativeSource={RelativeSource Self},                         Converter={StaticResource RequiredToBoolConverter}}'                         Value='True'>   <Setter Property='Background' Value='LightGreen' /> </DataTrigger> 

However, when this runs, I get the following:

System.Windows.Data Error: 39 : BindingExpression path error: ‘Validation’ property not found on ‘object’ ”TextBox’ (Name=”)’. BindingExpression:Path=Validation.Errors; DataItem=’TextBox’ (Name=”); target element is ‘TextBox’ (Name=”); target property is ‘NoTarget’ (type ‘Object’)

If I change my DataTrigger binding path to ‘Text’, I do not get the databinding error (but of course it does not provide the behaviour I am seeking).

  • 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. 2026-05-10T14:46:58+00:00Added an answer on May 10, 2026 at 2:46 pm

    You need to wrap the property in parentheses:

    <DataTrigger Binding='{Binding Path=(Validation.Errors).YourAttachedProperty,... 
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Possible Duplicate: How can one host Flash content in a WPF application and use
I' building an hobby project in WPF also decided to use Metro style theme
Is it possible to convert an existing WPF Application to SilverLight automatically/with minimal effort?
Is it possible to have a WPF window/element detect the drag'n'dropping of a file
Is it possible to find out whether WPF Window is loaded? I have a
Is it possible to set code behind a resource dictionary in WPF. For example
Is it possible to add checkboxes to the WPF TreeView object? I'd like to
i wonder if it is possible to cascade converters when using wpf databinding. e.g.
Is it possible to migrate a VB.NET Winform solution to a 3.5 WPF solution.
How is it possible to programmatically select an item in a WPF TreeView ?

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.