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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T04:20:13+00:00 2026-05-11T04:20:13+00:00

I have a DataTemplate that is displaying objects with three fields, e.g.: Name =

  • 0

I have a DataTemplate that is displaying objects with three fields, e.g.:

Name = 'Font Color' Value = 'Orange' Editable = 'True' 

but I want to display them as e.g.:

Font Color: Orange Editable

But I’m having trouble finding the syntax to use Triggers here in order to e.g. display ‘Editable’ when the field Editable=’True’

Does anyone know the syntax to do this?

The following code results in ‘Binding cannot be used in Property’:

<DataTemplate x:Key='settingsItemTemplate'>     <StackPanel Orientation='Horizontal'>         <Label Content='{Binding XPath=Name}' ContentStringFormat=' {0}:'/>         <Label Content='{Binding XPath=Value}'/>         <Label>             <Label.Triggers>                 <Trigger Property='{Binding XPath=Editable}' Value='True'>                     <Setter Property='Content' Value='Editable'/>                 </Trigger>                 <Trigger Property='{Binding XPath=Editable}' Value='False'>                     <Setter Property='Content' Value='NOT Editable'/>                 </Trigger>             </Label.Triggers>         </Label>     </StackPanel> </DataTemplate> 
  • 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-11T04:20:14+00:00Added an answer on May 11, 2026 at 4:20 am

    Would it work to use a TextBlock instead of a Label? TextBlock does have a Text property that you should be able to bind to in this case.

    If you really want to use a Label, another approach would be to create two DataTemplate‘s – one for the editable case, and another for non-editable. You can then bind the ContentTemplate property to the appropriate template.

    Update: After looking into it some more, it looks like Trigger does not support binding for its Property attribute. However, DataTrigger does support this:

    <StackPanel>     <CheckBox Name='EditableCheckBox'>Is Editable</CheckBox>     <Label>         <Label.Resources>             <Style TargetType='{x:Type Label}'>                 <Style.Triggers>                     <DataTrigger Binding='{Binding ElementName=EditableCheckBox, Path=IsChecked}' Value='True'>                         <Setter Property='Content' Value='Editable' />                     </DataTrigger>                     <DataTrigger Binding='{Binding ElementName=EditableCheckBox, Path=IsChecked}' Value='False'>                         <Setter Property='Content' Value='NOT Editable' />                     </DataTrigger>                 </Style.Triggers>             </Style>         </Label.Resources>     </Label> </StackPanel> 

    You should be able to modify the Binding attribute to bind to your XML data source instead of do the value of another control.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 156k
  • Answers 156k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer Flex suppresses errors inside of data setters, because stuff is… May 12, 2026 at 10:48 am
  • Editorial Team
    Editorial Team added an answer After much digging I found that you can use the… May 12, 2026 at 10:48 am
  • Editorial Team
    Editorial Team added an answer Change your link to the stylesheet to be screen and… May 12, 2026 at 10:48 am

Related Questions

I have the following DataTemplate in a Listbox <ListBox Grid.Column=1 Grid.Row=2 ItemsSource={Binding People} SelectedItem={Binding
Couldn't find an answer to this one. I have a WPF ListView control that
I want to build a simple application with the MVVM pattern. This application will
I have a ComboBox that doesn't seem to update the SelectedItem/SelectedValue. The ComboBox ItemsSource

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.