question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Drag Adorner at wrong position on High DPI screens

See original GitHub issue

Description When dragging an item from a ListBox the dragged item is shown at a wrong position offset to the lower right. This only occurs on a High DPI screens such as Notebooks. WrongOffsetAtHighDPIScreen

Repro This can be reproduced with the simplest of all programs:

<Window x:Class="DragItemScreenPositionIssue.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
        xmlns:dd="clr-namespace:GongSolutions.Wpf.DragDrop;assembly=GongSolutions.Wpf.DragDrop"
        mc:Ignorable="d"
        Title="MainWindow" Height="450" Width="800">
    <Grid>
        <ListBox dd:DragDrop.IsDropTarget="True" dd:DragDrop.IsDragSource="True"
                 dd:DragDrop.UseDefaultEffectDataTemplate="True" dd:DragDrop.UseDefaultDragAdorner="True">
            <ListBoxItem>ListBox Item #1</ListBoxItem>
            <ListBoxItem>ListBox Item #2</ListBoxItem>
            <ListBoxItem>ListBox Item #3</ListBoxItem>
        </ListBox>
    </Grid>
</Window>

Versions It is a regression between release 2.3.2 and 2.4.0. Tested with .NET Framework 4.8 and 4.5.2 (to rule out fix for issue #363).

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:12 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
punker76commented, Aug 26, 2021

@angus42 I found a solution. Hopefully it’s working without any issue with the GetCurrentPos…

0reactions
angus42commented, Aug 27, 2021

Agreed that using the path without the Canvas is better XAML. Still had to do a little scale transformation by 50% even with the Stretch=“Uniform”. But with that and the develop branch it now works under all situations I can come up with. Thx.

Read more comments on GitHub >

github_iconTop Results From Across the Web

HorizontalOffset goes in the wrong direction for High DPI ...
<summary> /// Handles drags that go "outside" the screen and returns the mouse delta from the last mouse position. /// When the user...
Read more >
DPI Aware UltraDockManager - Forums
The behavior of the splitter drag indicator being rendered in the wrong location is an issue that has already been address.
Read more >
Windows scaling issues for high-DPI devices
Discusses Windows scaling issues for high-DPI devices. Provides resolutions and workarounds for various scenarios.
Read more >
Drag and Drop Items in a WPF ListView
April 13, 2007 - Fixed a minor issue with the positioning of the drag adorner. The adorner used to "snap" into position, such...
Read more >
Mouse input in some games is incorrectly scaled on high- ...
This article describes how to work around an issue in which mouse input in some games is incorrectly scaled on high-DPI devices.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found