开发者

Determine if a DataGrid has focus based on ScrollViewer.ScrollChanged

I have a DataGrid and another plot view and they both can scroll horizontally since their data is correlated. I implemented each to scroll on their own. So I can scroll on the plot (old Winform, not WPF), and then the DataGrid ScrollIntoView gets called. OR I can scroll the DataGrid, and I have an eventhandler for the ScrollViewer.ScrollChanged to move the plot horizontally.

However, I am running into a circle with them calling each other if I implement them both. How do I determine which has focus, or create some sort of flags/state machine so that only o开发者_如何学运维ne gets called at a time? Thanks.


I had a similar issue. I was using ScrollViewer controls to provide the scrolling functionality.

Here is the link that helped me.

I used the provided attached property to bind the same property of the ViewModel to both ScrollViewer controls in two way mode.

Hope it helps.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜