Share via


IMarkupExtension Interface

Definition

Defines the interface for Xamarin.Forms XAML markup extensions.

public interface IMarkupExtension
type IMarkupExtension = interface
Derived

Remarks

Types implementing this interface can be used as custom XAML markup extension.

The following example shows declaration of a custom markup extension.
public class ColorMarkup : IMarkupExtension
{
  public int R { get; set; }
  public int G { get; set; }
  public int B { get; set; }

  public object ProvideValue (IServiceProvider serviceProvider)
  {
    return Color.FromRgb (R, G, B);
  }
}               
The markup extension can be used directly in XAML
<Label TextColor="{localns:ColorMarkup R=100, G=80, B=60}"/>

Methods

ProvideValue(IServiceProvider)

Returns the object created from the markup extension.

Applies to