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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T10:39:31+00:00 2026-05-23T10:39:31+00:00

I have a WPF 4.0 application and I am using the WPF DataGrid. What

  • 0

I have a WPF 4.0 application and I am using the WPF DataGrid. What I want is to use navigation buttons on my view to change the SelectedItem the DataGrid, rather than letting the user change the SelectedItem by clicking on the DataGrid. I am using an ICollectionView in my ViewModel as the ItemsSource for my DataGrid. Here is what I have so far:

NextCommand (ViewModel):

DefaultView.MoveCurrentToNext();  // DefaultView is an ICollectionView
SelectedItem = DefaultView.CurrentItem as MyProperty;

DataGrid (View):

<DataGrid ItemsSource="{Binding Path=DefaultView}"
          SelectedItem="{Binding Path=SelectedItem}"
          IsSynchronizedWithCurrentItem="True">
    ...
</DataGrid>

The navigation buttons work great… however, I do not want to allow the user to click on the DataGrid to change the SelectedItem. Any ideas on how to accomplish this? I’ve played around with the DataGrid_SelectionChanged event, but the problem is that the binding on the SelectedItem updates the ViewModel before this event even fires. I would prefer that the SelectedItem does not get changed twice (once when the user clicks, and twice when it is set back to the original). I am ok with using the Code behind if needed…

  • 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-23T10:39:31+00:00Added an answer on May 23, 2026 at 10:39 am

    Apparently you have to disable it through a custom DataGrid Template:

    http://www.wpfsharp.com/2011/05/how-to-disable-row-selection-in-a-wpf-datagrid/

    Out of curiosity, why do you want to do this? I mean why do you want to forbid a user from selecting a row by clicking it, but yet allow the user to select a row indirectly by using some navigation buttons?

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

Sidebar

Related Questions

I'm writing WPF application, that's using MVVMLight. I have a DataGrid and I wanna
I have a C# WPF application using a rather noddy MVVM approach. In one
I have a WPF application using MVVM; when I change the ViewModel in my
When writing a WPF application using MVVM, I want to use a WCF service,
Using the WPF DataGrid I have the need to change various display and related
I have a WPF application using Aero Glass. When using the application under a
I have a WPF Application using Fluent NHibernate 1.0 RTM and System.Data.SQLite 1.0.65 that
I have a very simple WPF application in which I am using data binding
In my WPF application I have some drawing functionality. I have solved this using
I have developed a simple DB-editing app using Xceed's excellent DataGrid for WPF (UX

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.