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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T01:23:24+00:00 2026-06-06T01:23:24+00:00

I got some problems in Datagrid WPF I have a datagrid, and I want

  • 0

I got some problems in Datagrid WPF

I have a datagrid, and I want to set the IsEnabled property of a single row to false whenever the user assign a value to the binding item of the datagrid itemSource

So I made it by datagrid Style triggers:

               <DataGrid AutoGenerateColumns="False" Margin="9,35,0,6" Name="dataGrid2" ItemsSource="{Binding}" SelectionChanged="dataGrid2_SelectionChanged" IsReadOnly="True" SelectionMode="Single">
                    <DataGrid.RowStyle>


                        <Style TargetType="{x:Type DataGridRow}">
                            <Style.Setters>
                                <Setter Property="IsEnabled" Value="False" />
                            </Style.Setters>
                            <Style.Triggers>
                                <DataTrigger Binding="{Binding Path=Coluna}" Value="{x:Null}">
                                    <Setter Property="IsEnabled" Value="True"/>
                                </DataTrigger>
                            </Style.Triggers>
                        </Style>



                    </DataGrid.RowStyle>
                    <DataGrid.Columns>
                        <DataGridTextColumn Header="Campo" Binding="{Binding Path=Campo}" Width="1.4*" CanUserSort="False" />
                        <DataGridTextColumn Header="Coluna/Constante" Binding="{Binding Path=Coluna}" CanUserSort="False" Width="*" />
                    </DataGrid.Columns>
                </DataGrid>

Working fine, it disables the entire row when a value is assigned to the “Coluna” field of that row (different of null)

The problem is: I still can click and select the disabled row using the right mouse button… Does the “IsEnabled” property only blocks the left mouse button click on datagrid rows?? Do I need to set another property to disable the right mouse button click on that row?

Thank you!

  • 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-06T01:23:26+00:00Added an answer on June 6, 2026 at 1:23 am

    This is a known bug of the DataGrid and it’s reported on Connect here: DatagridRow gets selected on right click even if the datagrid is disabled. Looks like this will be fixed in WPF 4.5.

    To workaround it you can bind IsHitTestVisible to IsEnabled

    <DataGrid ...>
        <DataGrid.RowStyle>
            <Style TargetType="{x:Type DataGridRow}">
                <Setter Property="IsEnabled" Value="False" />
                <Setter Property="IsHitTestVisible"
                        Value="{Binding RelativeSource={RelativeSource Self},
                                        Path=IsEnabled}"/>
                <Style.Triggers>
                    <DataTrigger Binding="{Binding Path=Coluna}" Value="{x:Null}">
                        <Setter Property="IsEnabled" Value="True"/>
                    </DataTrigger>
                </Style.Triggers>
            </Style>
        </DataGrid.RowStyle>
        <!-- ... -->
    </DataGrid>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm a beginner in Java and I have got some problems with the static
i've got some problems using jQTouch. I have this Link <a href=#site_map class=swap>Map</a> and
I am learning to use mysql.So, I got some problems. I have three table
I'm using EntityFramework, WPF and MVVM in my application and got some problems with
Working on implementation of paypal's recurring payments, I've got encountered some problems. I have
got some problems deploying a java web application on jboss 7.1... Stepped through the
I got some problems with avatars on my website, when there is a 35
I got some problems with EOF and stdio in a communication pipeline between a
I got some problems with the error Link error LNK2005 ... already defined. The
I've got some problems on a .NET site where both Latin (åäö) and Latvian

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.