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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T02:55:37+00:00 2026-06-17T02:55:37+00:00

I got a WPF DataGrid and in the DataGrid i want to have a

  • 0

I got a WPF DataGrid and in the DataGrid i want to have a column displayed dependent on a property outside of the DataGrid Context (from the ViewModel).

I have the same Property binding outside of the DataGrid for some labels (without the “DataContext.” ) and this works fine.

<DataGrid ItemsSource="{Binding Items.View}" AutoGenerateColumns="False"   x:Name="Overview" >

<DataGridTemplateColumn Header="{lex:Loc Value}" Width="Auto" Visibility="{Binding ElementName=Overview, Path=DataContext.CharacteristicMeasure.Characteristic.CharacteristicType.IsBool,Converter={StaticResource boolToInv}, ConverterParameter=true}" >
  <DataGridTemplateColumn.CellTemplate>
      <DataTemplate>
          <TextBlock Text="{Binding Value}" />
      </DataTemplate>
  </DataGridTemplateColumn.CellTemplate>
  <DataGridTemplateColumn.CellEditingTemplate>
      <DataTemplate>
          <TextBox Text="{Binding Value}"  />
      </DataTemplate>
  </DataGridTemplateColumn.CellEditingTemplate>
  </DataGridTemplateColumn>
</DataGridTemplateColumn>

Somehow this isnt effecting the Visibility property of the DataGridTemplateColumn at all. I dont know why and how to continue.

UPDATE

My output windows shows the following error:

    System.Windows.Data Error: 2 : Cannot find governing FrameworkElement or FrameworkContentElement for target element. BindingExpression:Path=DataContext.CharacteristicMeasure.Characteristic.CharacteristicType.IsBool; DataItem=null; target element is 'DataGridTemplateColumn' (HashCode=15721293); target property is 'Visibility' (type 'Visibility')

UPDATE 2

though i got the same Property Binded on another Visibility Property outside of the DataGrid

    <DockPanel Visibility="{Binding CharacteristicMeasure.Characteristic.CharacteristicType.IsBool,Converter={StaticResource boolToInv}, ConverterParameter=true}" >...

and this works fine.

  • 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-17T02:55:39+00:00Added an answer on June 17, 2026 at 2:55 am

    As strange as it sounds, the DataGridColumn class inherits directly from DependencyObject, so you can’t use bindings on its properties (it has no SetBinding method).

    Can’t figure out why.

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

Sidebar

Related Questions

I got some problems in Datagrid WPF I have a datagrid, and I want
I've got a WPF DataGrid that I have been using for some time, and
I got the following example of a WPF DataGrid bound to a ViewModel in
I've got a WPF application which contains a standard DataGrid showing a lot of
I got a WPF application and I want to download a file. I'm using
I've got a WPF ListView/GridView spec'd in XAML. The first column uses a CellTemplate
I've got a WPF RenderTargetBitmap in C++/CLI and I want to be able to
I defined datagrid in WPF, but i can't set the IsReadOnly Property in DataGridTextColumn
I've got a WPF application which calls MessageBox.Show() way back in the ViewModel (to
I have an ObservableCollection that is bound to a DataGrid where I want the

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.