Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Drag open a WPF expander using touch swipe

Tags:

c#

wpf

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

like image 718
Steven Wood Avatar asked Jun 02 '16 14:06

Steven Wood


1 Answers

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.

like image 101
LiamHarries Avatar answered Sep 29 '22 10:09

LiamHarries