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

Is it possible in WPF to bind a ListView (NOT a DataGrid) to a
Is it possible to animate the BringIntoView method in WPF? We want a nice
Is it possible to style WPF Toolkit's DataGrid so a data record can span
Possible Duplicate: Wpf Toolkit. Bind DataGrid Column Header to DynamicResource WPF Error: Cannot find
Is it possible to use a DataTrigger to set the angle of a RotateTransform
Is there a way to set an attached property via a Style? I have
Possible Duplicate: WPF: XAML property declarations not being set via Setters? I am stuck
Possible Duplicate: WPF MessageBox window style For some reason the MessageBox that comes with
In WPF it's possible to set a property of a custom control by either
Is it possible in WPF to implictly style a control that sits within another

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.