@@ -298,12 +298,12 @@ protected override void OnPropertyChanged([CallerMemberName] string propertyName
298298 this . ApplyIsSelected ( ) ;
299299 break ;
300300 case nameof ( this . TrailingIcon ) :
301- this . imgTrailing . Source = this . TrailingIcon ;
302- this . imgTrailingContainer . IsVisible = true ;
301+ this . imgTrailingIcon . Image . Source = this . TrailingIcon ;
302+ this . imgTrailingIcon . IsVisible = true ;
303303 break ;
304304 case nameof ( this . LeadingIcon ) :
305- this . imgLeading . Source = this . LeadingIcon ;
306- this . imgLeadingContainer . IsVisible = true ;
305+ this . imgTrailingIcon . Image . Source = this . LeadingIcon ;
306+ this . imgTrailingIcon . IsVisible = true ;
307307 break ;
308308 case nameof ( this . LeadingIconCommand ) :
309309 AddIconTapGesture ( false ) ;
@@ -322,32 +322,26 @@ private void AddIconTapGesture(bool isTrailingIcon)
322322 if ( this . frmContainer . GestureRecognizers . Count > 0 )
323323 this . frmContainer . GestureRecognizers . RemoveAt ( 0 ) ; //Remove main tap gesture
324324
325- TapGestureRecognizer tapIconGestureRecognizer = new TapGestureRecognizer ( ) ;
326- tapIconGestureRecognizer . Tapped += ( s , e ) =>
325+ if ( isTrailingIcon )
327326 {
328- if ( this . IsEnabled )
327+ this . imgTrailingIcon . Tapped = ( ) =>
329328 {
330- if ( isTrailingIcon )
329+ if ( this . IsEnabled && this . TrailingIconCommand != null )
331330 {
332- if ( this . TrailingIconCommand != null )
333- {
334- this . TrailingIconCommand . Execute ( this . TrailingIconCommandParameter ) ;
335- }
331+ this . TrailingIconCommand . Execute ( this . TrailingIconCommandParameter ) ;
336332 }
337- else
333+ } ;
334+ }
335+ else
336+ {
337+ this . imgLeadingIcon . Tapped = ( ) =>
338+ {
339+ if ( this . IsEnabled && this . LeadingIconCommand != null )
338340 {
339- if ( this . LeadingIconCommand != null )
340- {
341- this . LeadingIconCommand . Execute ( this . LeadingIconCommandParameter ) ;
342- }
341+ this . LeadingIconCommand . Execute ( this . LeadingIconCommandParameter ) ;
343342 }
344- }
345- } ;
346-
347- if ( isTrailingIcon )
348- imgTrailingContainer . GestureRecognizers . Add ( tapIconGestureRecognizer ) ;
349- else
350- imgLeadingContainer . GestureRecognizers . Add ( tapIconGestureRecognizer ) ;
343+ } ;
344+ }
351345 }
352346
353347 private void ApplyIsSelected ( )
0 commit comments