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

  • Home
  • SEARCH
  • 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 381137
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T15:03:23+00:00 2026-05-12T15:03:23+00:00

I am using a WPF Datagrid with a RowDetails panel where the RowDetailsVisibilityMode is

  • 0

I am using a WPF Datagrid with a RowDetails panel where the RowDetailsVisibilityMode is set to “VisibleWhenSelected” and the SelectionMode=”Extended” so that multiple rows can be selected and hence display RowDetails, as below:

<dg:DataGrid x:Name="MyGrid"
             ItemsSource="{Binding Path=MyItems}"
             AutoGenerateColumns="True"
             SelectionMode="Extended"
             RowDetailsVisibilityMode="VisibleWhenSelected">

  <dg:DataGrid.RowDetailsTemplate>
    <DataTemplate>
      <TextBlock Text="Further Details..."/>
    </DataTemplate>
  </dg:DataGrid.RowDetailsTemplate>
  ...
</dg:DataGrid>

Unfortunately, for this application it isn’t intuitive to display row details on ‘selected’ rows, the client would like to click a checkbox on a number of rows to display the RowDetails pane, but also scroll around the grid selecting other rows. In other words fix the rows that display RowDetails no matter what happens on the DataGrid.

So currently scrolling around closes the RowDetailsPanes that they have opened. What I would like to do is to have a checkbox in one of the columns and bind the RowDetails panel visibility to this property but I can’t figure out how to do it. The problem is simply that RowDetailsPane only operates on the row selection(s) in the datagrid – can it be extended somehow to operate on a property of my choosing?

Thanks in advance,
Will

  • 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-12T15:03:23+00:00Added an answer on May 12, 2026 at 3:03 pm

    Looking at the WPF toolkit source code each DataGridRow has a DetailsVisibility property.

    I put a button (just for testing) in the first column.

    <toolkit:DataGridTemplateColumn>
        <toolkit:DataGridTemplateColumn.CellTemplate>
            <DataTemplate>
                <Button x:Name="buttonDetails" Content="Hello" ButtonBase.Click="Details_Click" />
            </DataTemplate>
        </toolkit:DataGridTemplateColumn.CellTemplate>
    </toolkit:DataGridTemplateColumn>
    

    When the button is clicked, find the clicked row and toggle the property.

       private void Details_Click(object sender, RoutedEventArgs e)
        {
          try
          {
            // the original source is what was clicked.  For example 
            // a button.
            DependencyObject dep = (DependencyObject)e.OriginalSource;
    
            // iteratively traverse the visual tree upwards looking for
            // the clicked row.
            while ((dep != null) && !(dep is DataGridRow))
            {
              dep = VisualTreeHelper.GetParent(dep);
            }
    
            // if we found the clicked row
            if (dep != null && dep is DataGridRow)
            {
              // get the row
              DataGridRow row = (DataGridRow)dep;
    
              // change the details visibility
              if (row.DetailsVisibility == Visibility.Collapsed)
              {
                row.DetailsVisibility = Visibility.Visible;
              }
              else
              {
                row.DetailsVisibility = Visibility.Collapsed;
              }
            }
          }
          catch (System.Exception)
          {
          }
        }
    

    I have not explored doing this via databinding.

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

Sidebar

Ask A Question

Stats

  • Questions 275k
  • Answers 275k
  • 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 because I mostly use Jquery I wrote here a jquery… May 13, 2026 at 2:35 pm
  • Editorial Team
    Editorial Team added an answer BinX, the Binary XML Description Language, plus the corresponding library,… May 13, 2026 at 2:35 pm
  • Editorial Team
    Editorial Team added an answer When you invoke the Cluetip code, are you specifying a… May 13, 2026 at 2:35 pm

Related Questions

I am struggling with the learning curve on WPF data binding and could use
I have a WPF Toolkit DataGrid bound to an ObservableCollection of Car in my
I am trying to synchronize the horizontal scroll position of 2 WPF DataGrid controls.
I want to enable the user to highlight a row on the WPF DataGrid

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.