I have a control that is slightly longer than the screen, the user moves the contents from the left side of the screen in this control on the right Are there. When the user moves something up, we want to highlight the content where the content went.
Currently I can easily do this with the setting. Focus on control () It fills in.
By setting focus, if the control screen was off, focusing on it is located above or below the window.
- Is there any way to do this pad a little bit, when a control focus is made, it is centered on control and gives approximately 50px padding from the edge of the windows ?
- Also, is there a way to animate the scroll, so instead of jumping on the field, the window will actually scroll if necessary?
- Finally, is there an event that I can handle (such as Focus () or RecievedFocus () or OnFocus ()) when a Control Focus occurs? I probably would like to highlight the field that was focused, and I thought if I can handle the incident then it will only be highlighted for this, along with the above # 1.
Part 1: If you want to adjust the padding around your control, then You manually call BringIntoView event, which is when WPF automatically calls you when you focus on control. There is a TargetRect parameter in BringIntoView, which allows you to flush a bit to get padding. MSDN Documentation
Part 2: I used the Oxfire code on it, you have to override the style of control and replace the standard scroll weaver with an animated scrollwizard. In order to adjust the horizontal offset and vertical offset, you must also provide a RequestBringIntoView event handler (in the class you are viewing) in this case you have animatedScrollViewer.ScrollToPosition () inside your RequestBringIntoView handler (If you choose, you can provide padding in part 1 of this method).
Part 3: Hopefully you've covered @Christ ...
Comments
Post a Comment