Fabulous API
Documentation
2.0
2.0
  • Welcome
  • Xamarin.Forms
    • AnyView
    • Application
    • Element
    • NavigableElement
    • VisualElement
    • View
    • Controls
      • ActivityIndicator
      • BoxView
      • Button
      • CheckBox
      • DatePicker
      • Editor
      • Entry
      • FormattedLabel
      • ImageButton
      • Image
      • IndicatorView
      • InputView
      • Label
      • Picker
      • ProgressBar
      • RadioButton
      • SearchBar
      • Slider
      • Span
      • Stepper
      • Switch
      • TimePicker
      • WebView
    • Collections
      • CarouselView
      • CollectionView
      • ItemsView
      • ListView
    • Layouts
      • Layout
      • TemplatedView
  • .NET MAUI
    • AnyView
    • Application
    • Element
    • NavigableElement
    • VisualElement
    • View
    • Controls
      • ActivityIndicator
      • BoxView
      • Button
      • CheckBox
      • DatePicker
      • Editor
      • Entry
      • FormattedLabel
      • ImageButton
      • Image
      • IndicatorView
      • InputView
      • Label
      • Picker
      • ProgressBar
      • RadioButton
      • SearchBar
      • Slider
      • Span
      • Stepper
      • Switch
      • TimePicker
      • WebView
    • Collections
      • CarouselView
      • CollectionView
      • ItemsView
      • ListView
    • Layouts
      • Layout
      • TemplatedView
  • Avalonia
    • AnyView
    • Application
    • RenderOptions
    • Animatable
    • StyledElement
    • Transform
    • Visual
    • Layoutable
    • InputElement
    • DragDrop
    • FlyoutBase
    • PopupFlyoutBase
    • Control
    • Decorator
    • TemplatedControl
    • ContentControl
    • Spinner
    • TopLevel
    • TextElement
    • ItemsControl
    • SelectingItemsControl
    • MenuBase
    • WindowBase
    • Styling
      • KeyFrame
      • Animation
      • Transition
      • Style
    • Media
      • Transforms
        • Transform
        • MatrixTransform
        • SkewTransform
        • RotateTransform
        • TranslateTransform
        • ScaleTransform
        • Rotate3DTransform
        • TransformGroup
      • Brushes
        • Brush
        • TileBrush
        • SolidColorBrush
        • VisualBrush
        • ImageBrush
        • DrawingBrush
        • GradientStop
        • GradientBrush
        • ConicGradientBrush
        • LinearGradientBrush
        • RadialGradientBrush
      • PathSegments
        • PathSegment
        • ArcSegment
        • BezierSegment
        • PolyLineSegment
        • QuadraticBezierSegment
        • PathFigure
      • Geometries
        • Geometry
        • LineGeometry
        • EllipseGeometry
        • RectangleGeometry
        • PolylineGeometry
        • PathGeometry
        • CombinedGeometry
        • GeometryGroup
      • DashStyle
      • Pen
      • Drawing
      • Effects
Powered by GitBook
On this page
  • Constructors
  • Properties
  • Events
  • Usages
Edit on GitHub
  1. Xamarin.Forms
  2. Controls

ImageButton

PreviousFormattedLabelNextImage

Last updated 1 year ago

Inheritance: -> -> -> Xamarin.Forms documentation: ImageButton /

For details on how the control actually works, please refer to the .

Constructors

Constructors
Description

ImageButton(aspect: Aspect, light: ImageSource, onClicked: ‘msg, ?dark: ImageSource)

Define a ImageButton widget with an ImageSource depending if light or dark mode

ImageButton(aspect: Aspect, light: string, onClicked: ‘msg, ?dark: string)

Define a ImageButton widget with a path to an image depending if light or dark mode

ImageButton(aspect: Aspect, light: Uri, onClicked: ‘msg, ?dark: Uri)

Define a ImageButton widget with a URI to an image depending if light or dark mode

ImageButton(aspect: Aspect, light: Stream, onClicked: ‘msg, ?dark: Stream)

Define a ImageButton widget with an image Stream depending if light or dark mode

Properties

Properties
Description

borderColor(light: FabColor, ?dark: FabColor)

Sets the border color

borderWidth(value: float)

Sets the border width

cornerRadius(value: float)

Sets the corner radius

isLoading(value: bool)

Sets if the image is currently loading

isOpaque(value: bool)

Sets if the image is opaque

isPressed(value: bool)

Sets if the image is currently pressed

padding(value: Thickness)

Sets the padding

padding(value: float)

Sets a uniform padding

padding(left: float, top: float, right: float, bottom: float)

Sets the padding

reference(value: ViewRef<ImageButton>)

Sets a ViewRef instance to retrieve the Xamarin.Forms.ImageButton instance associated to this widget

Events

Properties
Description

onPressed(onPressed: ‘msg)

Sets the event handler for the image button pressed event

onReleased(onReleased: ‘msg)

Sets the event handler for the image button released event

Usages

ImageButton(Aspect.AspectFit, "image-light.png", dark = "image-dark.png")
    .borderColor(light = Color.Red.ToFabColor(), dark = Color.Blue.ToFabColor()) 
    .borderWidth(5.) 
    .isLoading(false) 
    .isOpaque(true) 
    .isPressed(false) 
    .padding(Thickness(5., 10., 5., 10.)) 
    .padding(10.) 
    .padding(5., 10., 5., 10.) 
    .onPressed(PressedMsg) 
    .onReleased(ReleasedMsg)
    
ImageButton(Aspect.AspectFit, FileImageSource(...), dark = StreamImageSource(...))

ImageButton(Aspect.AspectFit, Uri("http://..."), dark = Uri("http://..."))

ImageButton(Aspect.AspectFit, MemoryStream(), dark = FileStream())

Get access to the underlying Xamarin.Forms.ImageButton

let imageButtonRef = ViewRef<ImageButton>()

ImageButton(Aspect.AspectFit, light = "image-light.png", dark = "image-dark.png")
    .reference(imageButtonRef)
Element
NavigableElement
VisualElement
View
API
Guide
Xamarin.Forms documentation