@@ -51,11 +51,20 @@ public static readonly BindableProperty IsExpandedProperty
5151 public static readonly BindableProperty DirectionProperty
5252 = BindableProperty . Create ( nameof ( Direction ) , typeof ( ExpandDirection ) , typeof ( Expander ) , default ( ExpandDirection ) , propertyChanged : OnDirectionPropertyChanged ) ;
5353
54+ public static readonly BindableProperty TouchCaptureViewProperty
55+ = BindableProperty . Create ( nameof ( TouchCaptureView ) , typeof ( View ) , typeof ( Expander ) , propertyChanged : OnTouchCaptureViewPropertyChanged ) ;
56+
57+ public static readonly BindableProperty AnimationLengthProperty
58+ = BindableProperty . Create ( nameof ( AnimationLength ) , typeof ( uint ) , typeof ( Expander ) , defaultAnimationLength ) ;
59+
5460 public static readonly BindableProperty ExpandAnimationLengthProperty
55- = BindableProperty . Create ( nameof ( ExpandAnimationLength ) , typeof ( uint ) , typeof ( Expander ) , defaultAnimationLength ) ;
61+ = BindableProperty . Create ( nameof ( ExpandAnimationLength ) , typeof ( uint ) , typeof ( Expander ) , uint . MaxValue ) ;
5662
5763 public static readonly BindableProperty CollapseAnimationLengthProperty
58- = BindableProperty . Create ( nameof ( CollapseAnimationLength ) , typeof ( uint ) , typeof ( Expander ) , defaultAnimationLength ) ;
64+ = BindableProperty . Create ( nameof ( CollapseAnimationLength ) , typeof ( uint ) , typeof ( Expander ) , uint . MaxValue ) ;
65+
66+ public static readonly BindableProperty AnimationEasingProperty
67+ = BindableProperty . Create ( nameof ( AnimationEasing ) , typeof ( Easing ) , typeof ( Expander ) ) ;
5968
6069 public static readonly BindableProperty ExpandAnimationEasingProperty
6170 = BindableProperty . Create ( nameof ( ExpandAnimationEasing ) , typeof ( Easing ) , typeof ( Expander ) ) ;
@@ -146,6 +155,18 @@ public ExpandDirection Direction
146155 set => SetValue ( DirectionProperty , value ) ;
147156 }
148157
158+ public View ? TouchCaptureView
159+ {
160+ get => ( View ? ) GetValue ( TouchCaptureViewProperty ) ;
161+ set => SetValue ( TouchCaptureViewProperty , value ) ;
162+ }
163+
164+ public uint AnimationLength
165+ {
166+ get => ( uint ) GetValue ( AnimationLengthProperty ) ;
167+ set => SetValue ( AnimationLengthProperty , value ) ;
168+ }
169+
149170 public uint ExpandAnimationLength
150171 {
151172 get => ( uint ) GetValue ( ExpandAnimationLengthProperty ) ;
@@ -158,6 +179,12 @@ public uint CollapseAnimationLength
158179 set => SetValue ( CollapseAnimationLengthProperty , value ) ;
159180 }
160181
182+ public Easing AnimationEasing
183+ {
184+ get => ( Easing ) GetValue ( AnimationEasingProperty ) ;
185+ set => SetValue ( AnimationEasingProperty , value ) ;
186+ }
187+
161188 public Easing ExpandAnimationEasing
162189 {
163190 get => ( Easing ) GetValue ( ExpandAnimationEasingProperty ) ;
@@ -256,6 +283,9 @@ static void OnIsExpandedPropertyChanged(BindableObject bindable, object oldValue
256283 static void OnDirectionPropertyChanged ( BindableObject bindable , object oldValue , object newValue )
257284 => ( ( Expander ) bindable ) . OnDirectionPropertyChanged ( ( ExpandDirection ) oldValue ) ;
258285
286+ static void OnTouchCaptureViewPropertyChanged ( BindableObject bindable , object oldValue , object newValue )
287+ => ( ( Expander ) bindable ) . OnTouchCaptureViewPropertyChanged ( ( View ? ) oldValue ) ;
288+
259289 static object GetDefaultForceUpdateSizeCommand ( BindableObject bindable )
260290 => new Command ( ( ( Expander ) bindable ) . ForceUpdateSize ) ;
261291
@@ -271,8 +301,11 @@ void OnContentTemplatePropertyChanged()
271301 void OnIsExpandedPropertyChanged ( )
272302 => SetContent ( false ) ;
273303
274- void OnDirectionPropertyChanged ( ExpandDirection olddirection )
275- => SetDirection ( olddirection ) ;
304+ void OnDirectionPropertyChanged ( ExpandDirection oldDirection )
305+ => SetDirection ( oldDirection ) ;
306+
307+ void OnTouchCaptureViewPropertyChanged ( View ? oldView )
308+ => SetTouchCaptureView ( oldView ) ;
276309
277310 void OnIsExpandedChanged ( bool shouldIgnoreAnimation = false )
278311 {
@@ -319,7 +352,6 @@ void SetHeader(View? oldHeader)
319352 {
320353 if ( oldHeader != null )
321354 {
322- oldHeader . GestureRecognizers . Remove ( headerTapGestureRecognizer ) ;
323355 Control ? . Children . Remove ( oldHeader ) ;
324356 }
325357
@@ -329,9 +361,9 @@ void SetHeader(View? oldHeader)
329361 Control ? . Children . Insert ( 0 , Header ) ;
330362 else
331363 Control ? . Children . Add ( Header ) ;
332-
333- Header . GestureRecognizers . Add ( headerTapGestureRecognizer ) ;
334364 }
365+
366+ SetTouchCaptureView ( oldHeader ) ;
335367 }
336368
337369 void SetContent ( bool isForceUpdate , bool shouldIgnoreAnimation = false , bool isForceContentReset = false )
@@ -417,6 +449,14 @@ void SetDirection(ExpandDirection oldDirection)
417449 SetContent ( true , true , true ) ;
418450 }
419451
452+ void SetTouchCaptureView ( View ? oldView )
453+ {
454+ oldView ? . GestureRecognizers . Remove ( headerTapGestureRecognizer ) ;
455+ TouchCaptureView ? . GestureRecognizers ? . Remove ( headerTapGestureRecognizer ) ;
456+ Header ? . GestureRecognizers . Remove ( headerTapGestureRecognizer ) ;
457+ ( TouchCaptureView ?? Header ) ? . GestureRecognizers . Add ( headerTapGestureRecognizer ) ;
458+ }
459+
420460 void InvokeAnimation ( double startSize , double endSize , bool shouldIgnoreAnimation )
421461 {
422462 State = IsExpanded
@@ -443,6 +483,11 @@ void InvokeAnimation(double startSize, double endSize, bool shouldIgnoreAnimatio
443483 easing = ExpandAnimationEasing ;
444484 }
445485
486+ if ( length == uint . MaxValue )
487+ length = AnimationLength ;
488+
489+ easing ??= AnimationEasing ;
490+
446491 if ( lastVisibleSize > 0 )
447492 length = ( uint ) ( length * ( Abs ( endSize - startSize ) / lastVisibleSize ) ) ;
448493
0 commit comments