[英]WPF ScrollViewer
I was wondering if there is anyway to check if the up arrow or the bottom arrow of a wpf scroll viewer is clicked. 我想知道是否仍然可以检查是否单击了wpf滚动查看器的向上箭头或底部箭头。 I am trying to do it within a wpf textbox but, I want it to snap to the next line of a text instead of displaying partial text.
我正在尝试在wpf文本框中执行此操作,但是我希望它可以捕捉到文本的下一行,而不是显示部分文本。
So, the way for me to do this is when up/ or down is clicked. 因此,我的操作方式是单击向上/向下按钮。 i would say textBox.lineup/linedown.
我会说textBox.lineup / linedown。
but I also need to know which component is clicked in order to do so. 但我还需要知道要单击哪个组件。 Thanks in advance!
提前致谢!
-Kevin -凯文
You can use ScrollChanged event in ScrollViewer as below 您可以在ScrollViewer中使用ScrollChanged事件,如下所示
<ScrollViewer ScrollChanged="ScrollViewer_ScrollChanged">
In code you can get the verticalOffSet value. 在代码中,您可以获取verticalOffSet值。
private void ScrollViewer_ScrollChanged(object sender, ScrollChangedEventArgs e)
{
double verticalOffSet = e.VerticalOffset;
...
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.