11using System . Diagnostics . CodeAnalysis ;
22using System . Windows . Input ;
3+ using CommunityToolkit . Maui . Markup . Services ;
34
45namespace CommunityToolkit . Maui . Markup ;
56
67/// <summary>
78/// Extension Methods for Element Gestures
89/// </summary>
9- public static partial class GesturesExtensions
10+ [ DynamicallyAccessedMembers ( DynamicallyAccessedMemberTypes . PublicMethods ) ]
11+ public static class StringGesturesExtensions
1012{
1113 /// <summary>Add a <see cref="SwipeGestureRecognizer"/> and bind to its Command and (optionally) CommandParameter properties</summary>
1214 /// <param name="gestureElement">An <see cref="Element"/> implementing <see cref="IGestureRecognizers"/></param>
@@ -17,7 +19,6 @@ public static partial class GesturesExtensions
1719 /// <param name="direction">Swipe gesture direction</param>
1820 /// <param name="threshold">Minimum swipe distance that will cause the gesture to be recognized</param>
1921 /// <returns><paramref name="gestureElement"/></returns>
20- [ DynamicallyAccessedMembers ( DynamicallyAccessedMemberTypes . All ) ]
2122 [ RequiresUnreferencedCode ( "Using bindings with string paths is not trim safe. Use expression-based binding instead." ) ]
2223 public static TGestureElement BindSwipeGesture < TGestureElement > ( this TGestureElement gestureElement ,
2324 string commandPath ,
@@ -40,7 +41,6 @@ public static TGestureElement BindSwipeGesture<TGestureElement>(this TGestureEle
4041 /// <param name="parameterSource">Binding source for Command Binding</param>
4142 /// <param name="numberOfTapsRequired">Number of taps required to trigger the <see cref="ICommand"/></param>
4243 /// <returns><paramref name="gestureElement"/></returns>
43- [ DynamicallyAccessedMembers ( DynamicallyAccessedMemberTypes . All ) ]
4444 [ RequiresUnreferencedCode ( "Using bindings with string paths is not trim safe. Use expression-based binding instead." ) ]
4545 public static TGestureElement BindTapGesture < TGestureElement > ( this TGestureElement gestureElement ,
4646 string commandPath ,
@@ -163,45 +163,15 @@ public static TGestureElement TapGesture<TGestureElement>(this TGestureElement g
163163
164164 return gestureElement ;
165165 }
166-
167- static TGestureElement ConfigureSwipeGesture < TGestureElement > ( this TGestureElement gestureElement ,
168- SwipeGestureRecognizer swipeGesture ,
169- SwipeDirection ? direction = null ,
170- uint ? threshold = null ) where TGestureElement : IGestureRecognizers
171- {
172- if ( direction is not null )
173- {
174- swipeGesture . Direction = direction . Value ;
175- }
176-
177- if ( threshold is not null )
178- {
179- swipeGesture . Threshold = threshold . Value ;
180- }
181-
182- return gestureElement ;
183- }
184-
185- static TGestureElement ConfigureTapGesture < TGestureElement > ( this TGestureElement gestureElement ,
186- TapGestureRecognizer tapGesture ,
187- int ? numberOfTapsRequired = null ) where TGestureElement : IGestureRecognizers
188- {
189- if ( numberOfTapsRequired is not null )
190- {
191- tapGesture . NumberOfTapsRequired = numberOfTapsRequired . Value ;
192- }
193-
194- return gestureElement ;
195- }
196-
166+
197167 [ RequiresUnreferencedCode ( "Using bindings with string paths is not trim safe. Use expression-based binding instead." ) ]
198- static TGestureRecognizer BindGesture < TGestureElement , TGestureRecognizer > (
168+ static TGestureRecognizer BindGesture < TGestureElement , TGestureRecognizer > (
199169 this TGestureElement gestureElement ,
200170 string commandPath ,
201171 object ? commandSource = null ,
202172 string ? parameterPath = null ,
203173 object ? parameterSource = null ) where TGestureElement : IGestureRecognizers
204- where TGestureRecognizer : BindableObject , IGestureRecognizer , new ( )
174+ where TGestureRecognizer : BindableObject , IGestureRecognizer , new ( )
205175 {
206176 var gestureRecognizer = new TGestureRecognizer ( ) . BindCommand ( commandPath , commandSource , parameterPath , parameterSource ) ;
207177 gestureElement . GestureRecognizers . Add ( gestureRecognizer ) ;
0 commit comments