A control that resembles this style. , there is such a problem in the case of a horizontal scroll bar hiding. (The horizontal scroll bar will also be displayed, and I don't know how to solve it at the moment.) )
Because this control offset is to take advantage of the width of the StackPanel in the Itemspaneltemplate template of the ListBox by setting "(Uielement.rendertransform). (translatetransform.x) "to offset to the specified position.
So the horizontal scroll bar must be at the front of the movement, or the cheap location will be wrong.
Hold down 4, press and hold the mouse down to move out of the ListBox, and the scroll bar will automatically run to the end.
Workaround
How to disable ListBox auto scroll on mouse down and auto scrollIntoView on item selected?
public class TListBoxDisableScroll:System.Windows.Controls.ListBox { #region fix press and hold item down drag, scroll bar runs to the last protected override void Onpreviewmousemove (MouseEventArgs e) { base. Onpreviewmousemove (e); E.handled = true; } protected override void Onismousecapturedchanged (DependencyPropertyChangedEventArgs e) { } # Endregion }
Or force a scroll to the first
private void Scrollviewer_scrollchanged (object sender, System.Windows.Controls.ScrollChangedEventArgs e) { Thelistbox.scrollintoview (thelistbox.items[0]); This is where you add an event handler implementation. }
WPF, resolve the ListBox, press and hold ListBoxItem down to drag the listbox down, and the horizontal scroll bar runs to the end.