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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T15:40:42+00:00 2026-06-09T15:40:42+00:00

I have a DataTrigger attached to a style for TextBlock, defined as such: <DataTrigger

  • 0

I have a DataTrigger attached to a style for TextBlock, defined as such:

<DataTrigger Binding="{Binding Path=Link, Converter={StaticResource HasContentConverter}}" Value="True">
    <Setter Property="TextDecorations" Value="Underline" />
    <Setter Property="Cursor" Value="Hand" />
</DataTrigger>

The issue that I’m having is that I have multiple objects that end up using this style, some of which contain a “Link” property, and some of which don’t. Whenever the system encounters an object that doesn’t, it prints this error in the output window:

BindingExpression path error: ‘Link’ property not found on ‘object’ ”DataRowView’ (HashCode=53681904)’. BindingExpression:Path=Link; DataItem=’DataRowView’ (HashCode=53681904); target element is ‘TextBlock’ (Name=”); target property is ‘NoTarget’ (type ‘Object’)

This is expected behaviour, however I’m wondering if there’s a way to tell the processor in XAML to only apply if the “Link” property exists (ie. check for the property before attempting to bind, or some other method that doesn’t print an error). Is this possible?

  • 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-06-09T15:40:43+00:00Added an answer on June 9, 2026 at 3:40 pm

    So my final solution for this was to have a base DataGrid class that implements the style in question, minus the “Link” specific data trigger. Then I had a new DataGrid class that derived from my base class, with code to specifically create the data trigger:

    Binding binding = new Binding("Link");
    binding.Converter = new MDTCommon.Converters.HasContentConverter();
    DataTrigger trigger = new DataTrigger();
    trigger.Binding = binding;
    trigger.Value = true;
    Setter setter1 = new Setter(TextBlock.TextDecorationsProperty, TextDecorations.Underline);
    Setter setter2 = new Setter(TextBlock.CursorProperty, Cursors.Hand);
    trigger.Setters.Add(setter1);
    trigger.Setters.Add(setter2);
    Style style = FindResource("DefaultStyleInQuestion") as Style;
    style.Triggers.Add(trigger);
    

    I was able to use this method because the binding object that had the “Link” property was only used in my derived DataGrid class.

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

Sidebar

Related Questions

I have the following XAML: <TextBlock Text={Binding ElementName=EditListBox, Path=SelectedItems.Count} Margin=0,0,5,0/> <TextBlock Text=items selected> <TextBlock.Style>
I have a ListView with an ItemContainerStyle defined as such: <ListView Width=auto SelectionMode=Single ItemContainerStyle={StaticResource
I have the following Data template with triggers: <DataTemplate.Triggers> <DataTrigger Binding={Binding IsCalled} Value=Yes> <Setter
I have the next code in my view: <Style x:Key=documentFileNameStyle> <Setter Property=TextBlock.Foreground Value=Gray/> <Style.Triggers>
I have the following Data Trigger set-up on a Control Template <DataTrigger Binding={Binding Path=IsDragged}
I have the following xaml-Code: <Border x:Name=border> <Border.Style> <Style TargetType={x:Type Border}> <Style.Triggers> <DataTrigger Binding={Binding
I have the current DataTrigger: <DataTrigger Binding={Binding HeaderType} Value=1> <Setter Property=BorderThickness Value=5/></DataTrigger> I want
What I have now: <Style TargetType={x:Type ListBox} x:Key=PhotoListBoxStyle> <Style.Triggers> <Trigger Property={Binding Path=IsChecked, ElementName=DetailView} Value=False>
I have a DataTrigger setup like so: <UserControl.Resources> <Style x:Key=resultTypeStyle> <Style.Triggers> <DataTrigger Binding={Binding Result,
I want to have one Style DataTrigger inside my window.resources that can be used

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.