XamSpreadsheet Cell Selection Incorrect under certain DPI Settings and WinForms

This is related to a previous issue that has been fixed: 


I work with Walter (who reported the original issue) and we're seeing a new issue that could be related to this bug fix.  

I believe the method of figuring out the DPI so the XamSpreadsheet can scale properly is the issue.  In this stackoverflow post, someone comments that using this particular method to get the DPI can return the same response under different DPI settings: https://stackoverflow.com/a/21450169  Maybe there is a suggestion in there that can improve that DPI calculation in the situation outlined below.

The issue has to do with row selection.  It's like the cell selection code thinks that there are two cells in each DPI-adjusted cell.  For example, if you click the top half of any cell in row 1, the cell in row 1 is selected.  If you click the bottom half of any cell in row 1, the cell in row 2 is selected.  In the screenshot below you can see that the bottom of cell B3 has been clicked and B6 is the cell that ends up getting selected.  The probably gets increasingly worse as you try to select cells lower in the spreadsheet.

I have only been able to reproduce the issue consistently in a test project under these criteria:

  • DPI = 200%
  • Resolution = 3840 x 2160
  • Open WPF window from WinForms app

Set your DPI settings (sign out and back in to make sure they are fully "set"), open the sample solution and run the project "WindowsFormsApp", click Launch and then select rows in the spreadsheet and you should observe the above described behavior.  I also have a WpfApp in the solution that I was trying to reproduce the issue with, but couldn't get it to happen predictably.


NOTE: In our original issue we had a WinForms application that hosted a bunch of WPF windows and controls.  We have since made the hosting application WPF and still see this new issue.  We do still have a lot of WinForms in the application, so maybe it's just that some WinForms DLL gets loaded and throws everything off.  I'm not sure what triggers it though, so hopefully if the attached sample behavior is fixed it will fix our real scenario.

ANOTHER NOTE: I have seen this behavior on occasion when docking/undocking my laptop.  I am running mixed resolutions/DPIs though, so I'm not as worried about that.  This issue may be more Windows 10 related than the XamSpreadsheet control.  All the tests were performed undocked though as to simplify reproduction steps.

Thanks!  Your controls are great and your support is awesome!


  • 27620
    Offline posted

    Hello Jon,

    I have been investigating into the behavior you are reporting, and I have been able to reproduce it. While I do not have access to a machine / monitor that is capable of reaching 3840 x 2160 resolution, I am able to see weird issues in selection when running against a DPI of 200% in a 1920 x 1080 resolution. It also appears to be a little more severe than what you have reported in that when clicking a particular half of a cell, a different cell will be selected. I can't seem to get the cell that I clicked on to actually be selected in the DPI settings that I am using.

    This is unexpected behavior, and as such, I have asked our engineering staff to examine it further. To ensure it receives attention, I have logged this behavior in our internal tracking systems with a development ID of 255128. I have also created you a private support case so that you can be notified of a resolution to this issue when it becomes available. This support case has an ID of CAS-196823-X5T9L9 and you can access it here.

    Please let me know if you have any other questions or concerns on this matter.