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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T07:59:15+00:00 2026-05-13T07:59:15+00:00

I have a datagrid bound to a CollectionViewSource view in my view model. The

  • 0

I have a datagrid bound to a CollectionViewSource view in my view model. The datagrid has a CheckBoxColumn and three TextColumns, each bound to properties in the items in the view. I also have a bool property “Enabled” in the view item that I would like to use to make checkboxes in individual rows not visible. As an added bonus, it would be great to also change the foreground color of the other three columns for those rows too. But the main thing is to not let the user check the checkboxes in the rows where Enabled == false.

EDIT: Based on Stephen’s and Andrew’s links below, I have attempted to add a value converter as in the code below. For some reason though, it is not working. I am testing now on a CollectionView view that has 90 items in which the Enabled property of all but one of the items is false. So I am expecting 89 rows with invisible checkboxes and 1 row with a visible checkbox. However, all 90 rows have visible checkboxes. Any ideas?

<tk:DataGrid x:Name ="gridClaims" 
           Grid.Row="0"
           AutoGenerateColumns="False" 
           ItemsSource="{Binding ClaimViewModels.View}"
           Width="350" 
           HrizontalAlignment="Left">

 <tk:DataGrid.Resources>
      <BooleanToVisibilityConverter x:Key="boolToVis" />
 </tk:DataGrid.Resources>

 <tk:DataGrid.Columns>
      <tk:DataGridCheckBoxColumn 
           CellStyle="{StaticResource SingleClickEditing}"

           Binding="{Binding Path=Selected}" 
           Visibility="{Binding Path=Enabled, Converter={StaticResource boolToVis}}"

           CanUserSort="False" />

 </tk:DataGrid.Columns>

  • 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-05-13T07:59:16+00:00Added an answer on May 13, 2026 at 7:59 am

    For the Visibility function aspect, you would need a BooleanToVisbility converter which you’ll use and bind the Visible state of hte datagrid to the Enabled property in your datacontext object.

    Additionally, the Foreground color could be handled in the exact same way.

    EDIT: Add Links to Converters

    • http://blogs.imeta.co.uk/FMoreno/archive/2008/11/07/498.aspx
    • http://www.switchonthecode.com/tutorials/wpf-tutorial-binding-converters
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm using a DataGrid bound to a CollectionViewSource ( players ), itself bound to
I have a datagrid bound to an observable collection of objects. What I want
I have created a datagrid with columns bound to an observable collection. All works
I have a DataTable which is going to be bound to a DataGrid. I
I have a field in a DataGrid, bound to a value (Item.Amount), now inside
I have a TabControl where each tab contains a DataGrid . When the user
I have a list of names that I'd like to have bound to a
I have a context menu that is defined as a resource and bound to
Okay here's the situation. Net 4 WPF NO Silverlight. I have several Views that
I'm kind of new to WPF, and I'm trying to do some specialized data

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.