With ImageButton for Xamarin Forms you can easy add Buttons with only a Image to your View.
Add this to your XAML Page:
xmlns:local="clr-namespace:easterapps.xamarin.forms.controls" |
ImageButton with tapped animation
<local:ImageButton x:Name="button_sample" Source="sample.png" PressedEffect="True"> <Image.GestureRecognizers> <TapGestureRecognizer Tapped="sample_click" /> </Image.GestureRecognizers> </local:ImageButton> |
ImageButton with a second pressed_state image
<local:ImageButton x:Name="button_sample" Source="sample.png" SourcePressed="sample_pressed.png"> <Image.GestureRecognizers> <TapGestureRecognizer Tapped="sample_click" /> </Image.GestureRecognizers> </local:ImageButton> |
ImageButton with a second pressed_state image and animation
<local:ImageButton x:Name="button_sample" Source="sample.png" SourcePressed="sample_pressed.png" PressedEffect="True"> <Image.GestureRecognizers> <TapGestureRecognizer Tapped="sample_click" /> </Image.GestureRecognizers> </local:ImageButton> |
Attributes:
Source – The Main Image of the Button
PressedEffect (True|False) – if true, the Image have a tapped transistion/animations
SourcePressed – The PressedState Image
IsON – if False, the transition and pressedState are disabled
0 Kommentare