c# - Custom Hub Control for WP8.1 -
i have problems understanding how hub control built. main idea of want understand how build custom control allows perform gestures , not block controls inside.
using hub
control can press button
, see callback (color , size changing) , move pointer left slide hub
control.
sorry such stupid question don't have enough experience find responses myself. in advance advice.
the main problem associated using of gesturerecognizer
. have fixed problem refusing use gesturerecognizer
, starting use manipulation events on main container.
the simplified template code:
<style targettype="my:customhub"> <setter property="template"> <setter.value> <controltemplate targettype="my:customhub"> <grid x:name="rootgrid"> <contentpresenter x:name="mainpresenter" content="{templatebinding content}" /> </grid> </controltemplate> </setter.value> </setter> </style>
control's code-behind:
public sealed class customhub { public frameworkelement container { get; set; } public mainview() { this.initializecomponent(); } private void initgestureinteraction() { this.container = (frameworkelement)gettemplatechild("rootgrid"); this.container.manipulationmode = manipulationmodes.translatex | manipulationmodes.translaterailsx; this.container.manipulationstarted += (s, e) => { }; this.container.manipulationdelta += (s, e) => { var x = e.cumulative.translation.x; // implementation of moving }; this.container.manipulationcompleted += (s, e) => { var x = e.cumulative.translation.x; // implementation of moving }; } }
Comments
Post a Comment