Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
Dirkster99 committed Aug 24, 2021
2 parents 7268cab + 4caa231 commit 3b4b9bb
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions source/InplaceEditBoxLib/Views/EditBox.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -684,8 +684,11 @@ private void OnLostFocus(object sender, RoutedEventArgs e)
/// If an EditBox is in editing mode and the content of a ListView is
/// scrolled, then the EditBox switches to normal mode.
/// </summary>
private void OnScrollViewerChanged(object sender, RoutedEventArgs args)
private void OnScrollViewerChanged(object sender, ScrollChangedEventArgs args)
{
if (args.HorizontalOffset == 0 && args.VerticalOffset == 0)
return;

if (this.IsEditing && Mouse.PrimaryDevice.LeftButton == MouseButtonState.Pressed)
this.OnSwitchToNormalMode();
}
Expand Down Expand Up @@ -811,7 +814,7 @@ private void HookItemsControlEvents()
if (_ParentItemsControl != null)
{
// Handle events on parent control and determine whether to switch to Normal mode or stay in editing mode
_ParentItemsControl.AddHandler(ScrollViewer.ScrollChangedEvent, new RoutedEventHandler(this.OnScrollViewerChanged));
_ParentItemsControl.AddHandler(ScrollViewer.ScrollChangedEvent, new ScrollChangedEventHandler(this.OnScrollViewerChanged));
_ParentItemsControl.AddHandler(ScrollViewer.MouseWheelEvent, new RoutedEventHandler((s, e) => this.OnSwitchToNormalMode()), true);

_ParentItemsControl.MouseDown += new MouseButtonEventHandler((s, e) => this.OnSwitchToNormalMode());
Expand Down

0 comments on commit 3b4b9bb

Please sign in to comment.