Class Button
Forms9Patch Button.
Inheritance
Implements
Inherited Members
Namespace: Forms9Patch
Assembly: Forms9Patch.dll
Syntax
public class Button : Frame, INotifyPropertyChanged, IDynamicResourceHandler, IElement, INameScope, INavigationProxy, IStyleSelectable, IAnimatable, IResourcesProvider, IStyleElement, IFlowDirectionController, IPropertyPropagationController, IVisualController, ITabStopElement, IStylable, IGestureController, IGestureRecognizers, ILayout, ILayoutController, IPaddingElement, IControlTemplated, ILayout, IDisposable, IButton, IButtonController, IViewController, IVisualElementController, IElementController, IButtonState, IBackground, IShape, ILabel, ILabelStyle, IFontElement, IElement
Constructors
Button()
Initializes a new instance of the Button class.
Declaration
public Button()
Button(String, Image)
Instantiates an new Button and sets its Text and imageSource properties
Declaration
public Button(string text, Image image)
Parameters
| Type | Name | Description |
|---|---|---|
| String | text | |
| Image | image |
Button(String, String, Assembly)
Instantiates a new Button and sets its Text and either its IconText or its IconImage, created using the provided embedded resource id
Declaration
public Button(string text, string icon, Assembly assembly = null)
Parameters
| Type | Name | Description |
|---|---|---|
| String | text | Button's text |
| String | icon | Segments's icon (either EmbeddedResourceId or HtmlText) |
| Assembly | assembly | Assembly that has EmbeddedResource used for Icon |
Button(String, ImageSource)
Instantiates an new Button and sets its Text property and sets the IconImage to a new image, created using the provided ImageSource
Declaration
public Button(string text, ImageSource imageSource = null)
Parameters
| Type | Name | Description |
|---|---|---|
| String | text | |
| ImageSource | imageSource |
Fields
_constructing
The constructing.
Declaration
protected bool _constructing
Field Value
| Type | Description |
|---|---|
| Boolean |
_gestureListener
The gesture listener.
Declaration
protected Listener _gestureListener
Field Value
| Type | Description |
|---|---|
| Listener |
_iconImage
The image.
Declaration
protected Image _iconImage
Field Value
| Type | Description |
|---|---|
| Image |
_iconLabel
The icon label.
Declaration
protected Label _iconLabel
Field Value
| Type | Description |
|---|---|
| Label |
_label
The label.
Declaration
protected Label _label
Field Value
| Type | Description |
|---|---|
| Label |
AlignmentProperty
Backing store for the Button.Alignment bindable property
Declaration
public static BindableProperty AlignmentProperty
Field Value
| Type | Description |
|---|---|
| BindableProperty |
AutoFitProperty
The fit property.
Declaration
public static readonly BindableProperty AutoFitProperty
Field Value
| Type | Description |
|---|---|
| BindableProperty |
BackgroundColorProperty
Backing store for the BackgroundColor property
Declaration
public static readonly BindableProperty BackgroundColorProperty
Field Value
| Type | Description |
|---|---|
| BindableProperty |
BorderColorProperty
Backing store for Button's BorderColor property
Declaration
public static readonly BindableProperty BorderColorProperty
Field Value
| Type | Description |
|---|---|
| BindableProperty |
BorderWidthProperty
Backing store for Button's BorderWidth property
Declaration
public static readonly BindableProperty BorderWidthProperty
Field Value
| Type | Description |
|---|---|
| BindableProperty |
CommandParameterProperty
Backing store for the Button.CommandParameter bindable property.
Declaration
public static readonly BindableProperty CommandParameterProperty
Field Value
| Type | Description |
|---|---|
| BindableProperty |
CommandProperty
Backing store for the Button.Command bindable property.
Declaration
public static readonly BindableProperty CommandProperty
Field Value
| Type | Description |
|---|---|
| BindableProperty |
DarkThemeProperty
Backing store for the Button.DarkTheme property.
Declaration
public static readonly BindableProperty DarkThemeProperty
Field Value
| Type | Description |
|---|---|
| BindableProperty |
FitProperty
backing store for Fit property
Declaration
[Obsolete("FitProperty is obsolete. Use AutoFitProperty instead.", true)]
public static readonly BindableProperty FitProperty
Field Value
| Type | Description |
|---|---|
| BindableProperty |
FontAttributesProperty
Backing store for the Button.FontAttributes bindable property.
Declaration
public static readonly BindableProperty FontAttributesProperty
Field Value
| Type | Description |
|---|---|
| BindableProperty |
FontColorProperty
OBSOLETE: Use TextColorProperty
Declaration
[Obsolete("Use TextColorProperty", true)]
public static readonly BindableProperty FontColorProperty
Field Value
| Type | Description |
|---|---|
| BindableProperty |
FontFamilyProperty
Backing store for the Button.FontFamiily bindable property.
Declaration
public static readonly BindableProperty FontFamilyProperty
Field Value
| Type | Description |
|---|---|
| BindableProperty |
FontSizeProperty
Backing store for the Button.FontSize bindable property.
Declaration
public static readonly BindableProperty FontSizeProperty
Field Value
| Type | Description |
|---|---|
| BindableProperty |
HapticEffectModeProperty
The haptic mode property.
Declaration
public static readonly BindableProperty HapticEffectModeProperty
Field Value
| Type | Description |
|---|---|
| BindableProperty |
HapticEffectProperty
The haptic effect property.
Declaration
public static readonly BindableProperty HapticEffectProperty
Field Value
| Type | Description |
|---|---|
| BindableProperty |
HasShadowProperty
Backing store for the HasShadow property
Declaration
public static readonly BindableProperty HasShadowProperty
Field Value
| Type | Description |
|---|---|
| BindableProperty |
HasTightSpacingProperty
The has tight spacing property.
Declaration
public static readonly BindableProperty HasTightSpacingProperty
Field Value
| Type | Description |
|---|---|
| BindableProperty |
HorizontalTextAlignmentProperty
Backing store for the Button.Alignment bindable property
Declaration
public static BindableProperty HorizontalTextAlignmentProperty
Field Value
| Type | Description |
|---|---|
| BindableProperty |
HtmlTextProperty
Backing store for the formatted text property.
Declaration
public static readonly BindableProperty HtmlTextProperty
Field Value
| Type | Description |
|---|---|
| BindableProperty |
IconColorProperty
Backing store for Button IconColor property
Declaration
public static readonly BindableProperty IconColorProperty
Field Value
| Type | Description |
|---|---|
| BindableProperty |
IconFontFamilyProperty
Backing store for the icon font family property.
Declaration
public static readonly BindableProperty IconFontFamilyProperty
Field Value
| Type | Description |
|---|---|
| BindableProperty |
IconFontSizeProperty
Backing store for Button IconFontSize property
Declaration
public static readonly BindableProperty IconFontSizeProperty
Field Value
| Type | Description |
|---|---|
| BindableProperty |
IconImageProperty
Backing store for the IconImage property
Declaration
public static BindableProperty IconImageProperty
Field Value
| Type | Description |
|---|---|
| BindableProperty |
IconTextProperty
The image text property backing store
Declaration
public static readonly BindableProperty IconTextProperty
Field Value
| Type | Description |
|---|---|
| BindableProperty |
ImageSourceProperty
OBSOLETE: Use IconImageProperty
Declaration
[Obsolete("Use IconImageProperty", true)]
public static BindableProperty ImageSourceProperty
Field Value
| Type | Description |
|---|---|
| BindableProperty |
IsClippedProperty
Backing store for the IsClipped property.
Declaration
public static readonly BindableProperty IsClippedProperty
Field Value
| Type | Description |
|---|---|
| BindableProperty |
IsEllipticalProperty
backing store for IsEliptical property
Declaration
[Obsolete("Use ElementShapeProperty instead.", true)]
public static readonly BindableProperty IsEllipticalProperty
Field Value
| Type | Description |
|---|---|
| BindableProperty |
IsLongPressEnabledProperty
The is long press enabled property.
Declaration
public static readonly BindableProperty IsLongPressEnabledProperty
Field Value
| Type | Description |
|---|---|
| BindableProperty |
IsSelectedProperty
Backing store for the Button.IsSelected bindable property.
Declaration
public static BindableProperty IsSelectedProperty
Field Value
| Type | Description |
|---|---|
| BindableProperty |
LineBreakModeProperty
The line break mode property.
Declaration
public static readonly BindableProperty LineBreakModeProperty
Field Value
| Type | Description |
|---|---|
| BindableProperty |
LinesProperty
The lines property.
Declaration
public static readonly BindableProperty LinesProperty
Field Value
| Type | Description |
|---|---|
| BindableProperty |
MinFontSizeProperty
The backing store for the minimum font size property.
Declaration
public static readonly BindableProperty MinFontSizeProperty
Field Value
| Type | Description |
|---|---|
| BindableProperty |
OrientationProperty
Backing store for the Button's orientation property.
Declaration
public static BindableProperty OrientationProperty
Field Value
| Type | Description |
|---|---|
| BindableProperty |
OutlineColorProperty
Backing store for the OutlineColor property
Declaration
public static readonly BindableProperty OutlineColorProperty
Field Value
| Type | Description |
|---|---|
| BindableProperty |
OutlineWidthProperty
Backing store for the button's OutlineWidth property
Declaration
public static readonly BindableProperty OutlineWidthProperty
Field Value
| Type | Description |
|---|---|
| BindableProperty |
SelectedBackgroundColorProperty
Backing store for the Button.SelectedBackgroundColor bindable property.
Declaration
public static readonly BindableProperty SelectedBackgroundColorProperty
Field Value
| Type | Description |
|---|---|
| BindableProperty |
SelectedFontColorProperty
OBSOLETE: Use SelectedTextColorProperty
Declaration
[Obsolete("Use SelectedTextColorProperty", true)]
public static readonly BindableProperty SelectedFontColorProperty
Field Value
| Type | Description |
|---|---|
| BindableProperty |
SelectedTextColorProperty
Backing store for the SelectedTextColor property
Declaration
public static readonly BindableProperty SelectedTextColorProperty
Field Value
| Type | Description |
|---|---|
| BindableProperty |
SoundEffectModeProperty
The backing store for the sound effect mode property.
Declaration
public static readonly BindableProperty SoundEffectModeProperty
Field Value
| Type | Description |
|---|---|
| BindableProperty |
SoundEffectProperty
The sound effect property backing store
Declaration
public static readonly BindableProperty SoundEffectProperty
Field Value
| Type | Description |
|---|---|
| BindableProperty |
SpacingProperty
Backing store for the spacing property.
Declaration
public static readonly BindableProperty SpacingProperty
Field Value
| Type | Description |
|---|---|
| BindableProperty |
StickyBehaviorProperty
OBSOLETE: Use ToggleBehaviorProperty instead.
Declaration
[Obsolete("StickyBehavior property is obsolete, use ToggleBehavior instead", true)]
public static BindableProperty StickyBehaviorProperty
Field Value
| Type | Description |
|---|---|
| BindableProperty |
TextColorProperty
Backing store for the TextColor property
Declaration
public static readonly BindableProperty TextColorProperty
Field Value
| Type | Description |
|---|---|
| BindableProperty |
TextProperty
Backing store for the Button.Text bindable property.
Declaration
public static readonly BindableProperty TextProperty
Field Value
| Type | Description |
|---|---|
| BindableProperty |
TintIconProperty
The tint image property backing store.
Declaration
public static readonly BindableProperty TintIconProperty
Field Value
| Type | Description |
|---|---|
| BindableProperty |
TintImageProperty
OBSOLETE: Used TintIconProperty
Declaration
[Obsolete("Use TintIconProperty", true)]
public static readonly BindableProperty TintImageProperty
Field Value
| Type | Description |
|---|---|
| BindableProperty |
ToggleBehaviorProperty
Backing store for the Button.ToggleBehavior bindable property.
Declaration
public static BindableProperty ToggleBehaviorProperty
Field Value
| Type | Description |
|---|---|
| BindableProperty |
TrailingIconProperty
Backing store for the trailing image property.
Declaration
public static readonly BindableProperty TrailingIconProperty
Field Value
| Type | Description |
|---|---|
| BindableProperty |
TrailingImageProperty
OBSOLETE: Use TrailingIconProperty
Declaration
[Obsolete("Use TrailingIconProperty", true)]
public static readonly BindableProperty TrailingImageProperty
Field Value
| Type | Description |
|---|---|
| BindableProperty |
VerticalTextAlignmentProperty
Backing store for the vertical alignment property.
Declaration
public static readonly BindableProperty VerticalTextAlignmentProperty
Field Value
| Type | Description |
|---|---|
| BindableProperty |
Properties
Alignment
Gets or sets the alignment of the image and text.
Declaration
[Obsolete("Alignment is obsolete, see HorizontalTextAlignment and VerticalTextAlignment", true)]
public TextAlignment Alignment { get; set; }
Property Value
| Type | Description |
|---|---|
| TextAlignment | The alignment (left, center, right). |
AutoFit
Gets or sets the fit.
Declaration
public AutoFit AutoFit { get; set; }
Property Value
| Type | Description |
|---|---|
| AutoFit | The fit. |
BackgroundColor
Gets or sets the button's background color
Declaration
public Color BackgroundColor { get; set; }
Property Value
| Type | Description |
|---|---|
| Color |
BorderColor
controls value of .BorderColor property
Declaration
public Color BorderColor { get; set; }
Property Value
| Type | Description |
|---|---|
| Color |
BorderWidth
controls value of .BorderWidth property
Declaration
public float BorderWidth { get; set; }
Property Value
| Type | Description |
|---|---|
| Single |
Command
Gets or sets the command to invoke when the button is activated. This is a bindable property.
Declaration
public ICommand Command { get; set; }
Property Value
| Type | Description |
|---|---|
| ICommand | A command to invoke when the button is activated. The default value is null. |
Remarks
This property is used to associate a command with an instance of a button. This property is most often set in the MVVM pattern to bind callbacks back into the ViewModel. IsEnabled is controlled by the Command if set.
CommandParameter
Gets or sets the parameter to pass to the Command property. This is a bindable property.
Declaration
public object CommandParameter { get; set; }
Property Value
| Type | Description |
|---|---|
| Object | A object to pass to the command property. The default value is null. |
Content
Do not use
Declaration
[Obsolete("Content property is not supported", true)]
public VisualElement Content { get; set; }
Property Value
| Type | Description |
|---|---|
| VisualElement |
DarkTheme
Gets or sets a value indicating whether this Button if for a dark theme.
Declaration
public bool DarkTheme { get; set; }
Property Value
| Type | Description |
|---|---|
| Boolean |
|
Fit
Gets/Sets the Fit property
Declaration
[Obsolete("Fit property is obsolete. Use AutoFit property instead.", true)]
public LabelFit Fit { get; set; }
Property Value
| Type | Description |
|---|---|
| LabelFit |
FittedFontSize
Gets the FittedFontSize of the button's text (assuming it hasn't been overridden by SychronizedFontSize
Declaration
public double FittedFontSize { get; }
Property Value
| Type | Description |
|---|---|
| Double |
FontAttributes
Gets or sets the font attributes.
Declaration
public FontAttributes FontAttributes { get; set; }
Property Value
| Type | Description |
|---|---|
| FontAttributes | The font attributes. |
FontColor
OBSOLETE: Use TextColor
Declaration
[Obsolete("Use TextColor", true)]
public Color FontColor { get; set; }
Property Value
| Type | Description |
|---|---|
| Color | The color of the font. |
FontFamily
Gets or sets the font family.
Declaration
public string FontFamily { get; set; }
Property Value
| Type | Description |
|---|---|
| String | The font family. |
FontSize
Gets or sets the size of the font.
Declaration
public double FontSize { get; set; }
Property Value
| Type | Description |
|---|---|
| Double | The size of the font. |
HapticEffect
Gets or sets the haptic effect.
Declaration
public HapticEffect HapticEffect { get; set; }
Property Value
| Type | Description |
|---|---|
| HapticEffect | The haptic effect. |
HapticEffectMode
Gets or sets the haptic mode.
Declaration
public EffectMode HapticEffectMode { get; set; }
Property Value
| Type | Description |
|---|---|
| EffectMode | The haptic mode. |
HasShadow
controls if the button has a shadow
Declaration
public bool HasShadow { get; set; }
Property Value
| Type | Description |
|---|---|
| Boolean |
HasTightSpacing
Gets or sets if the Icon/Image is close (TightSpacing) to text or at edge (not TightSpacing) of button.
Declaration
public bool HasTightSpacing { get; set; }
Property Value
| Type | Description |
|---|---|
| Boolean |
|
HorizontalTextAlignment
Gets or sets the alignment of the image and text.
Declaration
public TextAlignment HorizontalTextAlignment { get; set; }
Property Value
| Type | Description |
|---|---|
| TextAlignment | The alignment (left, center, right). |
HtmlText
Gets or sets the formatted text.
Declaration
public string HtmlText { get; set; }
Property Value
| Type | Description |
|---|---|
| String | The formatted text. |
IconColor
Overrides the icon color as provided by the Button's TextColor (if TintIcon=true), the default TextColor (if IconText != null), or the IconImage colors
Declaration
public Color IconColor { get; set; }
Property Value
| Type | Description |
|---|---|
| Color |
IconFontFamily
Gets or sets the font family for the IconText
Declaration
public string IconFontFamily { get; set; }
Property Value
| Type | Description |
|---|---|
| String | The icon font family. |
IconFontSize
Overrides the default icon font size (the button's FontSize).
Declaration
public double IconFontSize { get; set; }
Property Value
| Type | Description |
|---|---|
| Double |
IconImage
Gets or sets the icon image. Alternatively, use IconText
Declaration
public Image IconImage { get; set; }
Property Value
| Type | Description |
|---|---|
| Image |
IconText
Gets or sets the image text - use this to specify the image as an HTML markup string.
Declaration
public string IconText { get; set; }
Property Value
| Type | Description |
|---|---|
| String | The image text. |
ImageSource
OBSOLETE: Use IconImage.
Declaration
[Obsolete("Use IconImage", true)]
public ImageSource ImageSource { get; set; }
Property Value
| Type | Description |
|---|---|
| ImageSource | The image. |
IsClipped
Gets or sets a value indicating whether the contents of this Button is clipped.
Declaration
public bool IsClipped { get; }
Property Value
| Type | Description |
|---|---|
| Boolean |
|
IsElliptical
Gets/Sets the IsEliptical property
Declaration
[Obsolete("Use ElementShape property instead.", true)]
public bool IsElliptical { get; set; }
Property Value
| Type | Description |
|---|---|
| Boolean |
IsLongPressEnabled
Gets or sets a value indicating whether this Button has long press enabled.
Declaration
public bool IsLongPressEnabled { get; set; }
Property Value
| Type | Description |
|---|---|
| Boolean |
|
IsSelected
Gets or sets a value indicating whether this Button is selected.
Declaration
public bool IsSelected { get; set; }
Property Value
| Type | Description |
|---|---|
| Boolean |
|
LineBreakMode
Gets or sets the line break mode.
Declaration
public LineBreakMode LineBreakMode { get; set; }
Property Value
| Type | Description |
|---|---|
| LineBreakMode | The line break mode. |
Lines
Gets or sets the lines.
Declaration
public int Lines { get; set; }
Property Value
| Type | Description |
|---|---|
| Int32 | The lines. |
MinFontSize
Gets or sets the minimum size of the font allowed during an autofit.
Declaration
public double MinFontSize { get; set; }
Property Value
| Type | Description |
|---|---|
| Double | The minimum size of the font. Default=4 |
Orientation
Gets or sets the orientation of the iamge and label.
Declaration
public StackOrientation Orientation { get; set; }
Property Value
| Type | Description |
|---|---|
| StackOrientation | The image and label orientation. |
OutlineColor
controls the outline color of the button
Declaration
public Color OutlineColor { get; set; }
Property Value
| Type | Description |
|---|---|
| Color |
OutlineWidth
controls the width of the button's outline
Declaration
public float OutlineWidth { get; set; }
Property Value
| Type | Description |
|---|---|
| Single |
SelectedBackgroundColor
Gets or sets the background color used when selected.
Declaration
public Color SelectedBackgroundColor { get; set; }
Property Value
| Type | Description |
|---|---|
| Color | The selected background. |
SelectedFontColor
OBSOLETE: Use SelectedTextColor
Declaration
[Obsolete("Use SelectedTextColor", true)]
public Color SelectedFontColor { get; set; }
Property Value
| Type | Description |
|---|---|
| Color | The color of the font. |
SelectedTextColor
Gets or sets the font color of the Text or the base font color of the HtmlText for when the button is selected
Declaration
public Color SelectedTextColor { get; set; }
Property Value
| Type | Description |
|---|---|
| Color |
SoundEffect
Gets or sets the sound effect.
Declaration
public SoundEffect SoundEffect { get; set; }
Property Value
| Type | Description |
|---|---|
| SoundEffect | The sound effect. |
SoundEffectMode
Gets or sets the sound effect mode.
Declaration
public EffectMode SoundEffectMode { get; set; }
Property Value
| Type | Description |
|---|---|
| EffectMode | The sound effect mode. |
Spacing
Gets or sets the spacing.
Declaration
public double Spacing { get; set; }
Property Value
| Type | Description |
|---|---|
| Double | The spacing. |
StickyBehavior
OBSOLETE: Use ToggleBehavior instead.
Declaration
[Obsolete("StickyBehavior property is obsolete, use ToggleBehavior instead", true)]
public bool StickyBehavior { get; set; }
Property Value
| Type | Description |
|---|---|
| Boolean |
SynchronizedFontSize
Overrides the button's label's FontSize for the purpose of synchronization between
Declaration
public double SynchronizedFontSize { get; set; }
Property Value
| Type | Description |
|---|---|
| Double |
Text
Gets or sets the text.
Declaration
public string Text { get; set; }
Property Value
| Type | Description |
|---|---|
| String | The text. |
TextColor
Gets or sets the font color of the Text or the base font color of the HtmlText
Declaration
public Color TextColor { get; set; }
Property Value
| Type | Description |
|---|---|
| Color |
TintIcon
Will the TextColor be used to tint the IconImage?
Declaration
public bool TintIcon { get; set; }
Property Value
| Type | Description |
|---|---|
| Boolean |
|
TintImage
OBSOLETE: Use TintIcon property
Declaration
[Obsolete("Use TintIcon", true)]
public bool TintImage { get; set; }
Property Value
| Type | Description |
|---|---|
| Boolean |
ToggleBehavior
Gets or sets a value indicating whether this Button will stay selected or unselected after a tap.
Declaration
public bool ToggleBehavior { get; set; }
Property Value
| Type | Description |
|---|---|
| Boolean |
|
TrailingIcon
Gets or sets if the image is to be rendered after the text.
Declaration
public bool TrailingIcon { get; set; }
Property Value
| Type | Description |
|---|---|
| Boolean | default=false |
TrailingImage
OBSOLETE: Use TrailingIcon
Declaration
[Obsolete("Use TrailingIcon", true)]
public bool TrailingImage { get; set; }
Property Value
| Type | Description |
|---|---|
| Boolean |
VerticalTextAlignment
Gets or sets the vertical alignment.
Declaration
public TextAlignment VerticalTextAlignment { get; set; }
Property Value
| Type | Description |
|---|---|
| TextAlignment | The vertical alignment. |
Methods
CheckIsClipped(Double, Double)
Test if the segment contents are clipped
Declaration
public bool CheckIsClipped(double width = -1, double height = -1)
Parameters
| Type | Name | Description |
|---|---|---|
| Double | width | |
| Double | height |
Returns
| Type | Description |
|---|---|
| Boolean |
Dispose(Boolean)
Dispose the specified disposing.
Declaration
protected override void Dispose(bool disposing)
Parameters
| Type | Name | Description |
|---|---|---|
| Boolean | disposing | Disposing. |
Overrides
GetMinSize()
What is the smallest that this button can be rendered (in one line of text)
Declaration
public Size GetMinSize()
Returns
| Type | Description |
|---|---|
| Size |
InvokeLongPressed(Object, EventArgs)
Invokes the long pressed.
Declaration
protected void InvokeLongPressed(object sender, EventArgs args)
Parameters
| Type | Name | Description |
|---|---|---|
| Object | sender | Sender. |
| EventArgs | args | Arguments. |
InvokeLongPressing(Object, EventArgs)
Invokes the long pressing.
Declaration
protected void InvokeLongPressing(object sender, EventArgs args)
Parameters
| Type | Name | Description |
|---|---|---|
| Object | sender | Sender. |
| EventArgs | args | Arguments. |
InvokeSelected(Object, EventArgs)
Invokes the selected.
Declaration
protected void InvokeSelected(object sender, EventArgs args)
Parameters
| Type | Name | Description |
|---|---|---|
| Object | sender | Sender. |
| EventArgs | args | Arguments. |
InvokeTapped(Object, EventArgs)
Invokes the tapped.
Declaration
protected void InvokeTapped(object sender, EventArgs args)
Parameters
| Type | Name | Description |
|---|---|---|
| Object | sender | Sender. |
| EventArgs | args | Arguments. |
OnDown(Object, DownUpEventArgs)
Called when button is pressed down
Declaration
protected virtual void OnDown(object sender, DownUpEventArgs e)
Parameters
| Type | Name | Description |
|---|---|---|
| Object | sender | |
| DownUpEventArgs | e |
OnLongPressed(Object, LongPressEventArgs)
Called whe button is released after long press
Declaration
protected virtual void OnLongPressed(object sender, LongPressEventArgs e)
Parameters
| Type | Name | Description |
|---|---|---|
| Object | sender | |
| LongPressEventArgs | e |
OnLongPressing(Object, LongPressEventArgs)
Called whe button has been long pressed
Declaration
protected virtual void OnLongPressing(object sender, LongPressEventArgs e)
Parameters
| Type | Name | Description |
|---|---|---|
| Object | sender | |
| LongPressEventArgs | e |
OnPropertyChanged(String)
Call this method from a child class to notify that a change happened on a property.
Declaration
protected override void OnPropertyChanged(string propertyName = null)
Parameters
| Type | Name | Description |
|---|---|---|
| String | propertyName | The name of the changed property. |
Overrides
Remarks
A Button triggers this by itself. An inheritor only need to call this for properties without BindableProperty as backend store.
OnPropertyChanging(String)
Call this method from a child class to notify that a change happened on a property.
Declaration
protected override void OnPropertyChanging(string propertyName = null)
Parameters
| Type | Name | Description |
|---|---|---|
| String | propertyName | The name of the changed property. |
Overrides
Remarks
A Button triggers this by itself. An inheritor only need to call this for properties without BindableProperty as backend store.
OnTapped(Object, TapEventArgs)
Called when button is tapped
Declaration
protected virtual void OnTapped(object sender, TapEventArgs e)
Parameters
| Type | Name | Description |
|---|---|---|
| Object | sender | |
| TapEventArgs | e |
OnUp(Object, DownUpEventArgs)
Called when button is released
Declaration
protected virtual void OnUp(object sender, DownUpEventArgs e)
Parameters
| Type | Name | Description |
|---|---|---|
| Object | sender | |
| DownUpEventArgs | e |
SendClicked()
Xamarin.Forms.IButtonController SendClicked method
Declaration
public void SendClicked()
SendTapped()
Sends the tapped.
Declaration
protected void SendTapped()
Tap()
Tap this instance.
Declaration
public void Tap()
ToString()
Declaration
public override string ToString()
Returns
| Type | Description |
|---|---|
| String |
Overrides
UpdateElements(Boolean)
Updates the elements in the button
Declaration
protected virtual void UpdateElements(bool isSegment = false)
Parameters
| Type | Name | Description |
|---|---|---|
| Boolean | isSegment |
Events
Clicked
Xamarin.Forms.IButton Clicked event
Declaration
public event EventHandler Clicked
Event Type
| Type | Description |
|---|---|
| EventHandler |
LongPressed
Occurs when long pressed has completed.
Declaration
public event EventHandler LongPressed
Event Type
| Type | Description |
|---|---|
| EventHandler |
LongPressing
Occurs when button is actively being long pressed
Declaration
public event EventHandler LongPressing
Event Type
| Type | Description |
|---|---|
| EventHandler |
Pressed
Xamarin.Forms.IButton Pressed event
Declaration
public event EventHandler Pressed
Event Type
| Type | Description |
|---|---|
| EventHandler |
Released
Xamarin.Forms.IButton Released event
Declaration
public event EventHandler Released
Event Type
| Type | Description |
|---|---|
| EventHandler |
Selected
Occurs when transitioned to IsSelected=true.
Declaration
public event EventHandler Selected
Event Type
| Type | Description |
|---|---|
| EventHandler |
Tapped
Occurs when the Button is clicked.
Declaration
public event EventHandler Tapped
Event Type
| Type | Description |
|---|---|
| EventHandler |
Remarks
The user may be able to raise the clicked event using accessibility or keyboard controls when the Button has focus.