简体   繁体   中英

Drag open a WPF expander using touch swipe

I have a requirement for an expander that can be used via touch control. I have no trouble expanding the expander when the user touches the toggle button, however I would like to expand by dragging the expander, (much like the expander on the iPhone where you swipe down from the top)

I can use the manipulation events to capture a swipe gesture and I can open the expander using that event. However I have no idea how to make the expansion state follow the finger.

I would like it so that if you drag to a certain percentage of its final size it will snap open if you let it go and if less than this percentage snap closed.

I am at a loss and can;t find anything on google related to this issue so any help would be gratefully received

Have a look into the possibility of using a GridSplitter. I have used these before to make finger dragable UI however not to expand an expander. I imagine a grid with three columns, center containing the gridsplitter and right containing a fixed size may give you the functionality you want however this may need some converters/code behind to keep this in sync with properties such as the IsExpanded property.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM