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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T18:08:47+00:00 2026-05-22T18:08:47+00:00

I have DataTemplates where the elements don’t always fill the entire cell (ie. because

  • 0

I have DataTemplates where the elements don’t always fill the entire cell (ie. because I increase the row height).

Now a row gets selected only if I click inside the element, if I click outside the element, but still in the row nothing happens.

How to make a WPF datagrid row selectable even if I click in between to elements.

One idea would be to listen to the MouseDown in the datagrid, but how can I identify the Row

Update: A work around is to give all the cell datatemplate a border with transparent background to fill the cell (I find this not very elegant).

  • 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-22T18:08:48+00:00Added an answer on May 22, 2026 at 6:08 pm

    I not sure know why you think adding a “buffer” around your content is not a very elegant way to achieve the goal of enlarging the clickable region of that content.

    I think that it is exactly what you should do and that it makes perfect sense architecturally, from the point of view of style, and most importantly from my point of view, for clarity and simplicity.

    It is true there are other solutions that will give the same net effect to the user but the buffer approach does have this elegant property:

    • If you click it and it responds, what you clicked is part of the content that responds

    Programming as a whole can be rather inelegant. It is often a bunch of special cases and complicated solutions to what seem like they should be easy problems. The famous computer scientist Donald Knuth has said that he feels what makes programmers programmers is their ability to cope with these inelegant things. The things that would make a mathematician go crazy.

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

Sidebar

Related Questions

Suppose you have WPF Window composed of many elements that are using DataTemplates /
I have a listbox that uses datatemplates and one of the elements in the
In my application, I would like to have DataTemplates such that I can say:
I have 8 different XAML DataTemplates that are all very similar. Here are 2
I have declared a DataTemplate in Window.Resources; I don't intend to use it inside
I have a PivotControl that contains ListBox elements: <controls:Pivot Title=SECTIONS x:Name=pivotControl ItemsSource={Binding SectionViewModels}> <controls:Pivot.HeaderTemplate>
I have a form that is generated based on several DataTemplate elements. One of
I have a code like that: <ListBox Height=522 HorizontalAlignment=Left Margin=20,162,0,0 Name=listBox1 VerticalAlignment=Top Width=448 >
I have Datagrid which is clicking by mouse in each row is showing data
I have an XML like this :: <?xml version=1.0 encoding=utf-8 ?> <Rows> <Row Id=1>

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.