IMarkupExtension IMarkupExtension Interface


Defines the interface for Xamarin.Forms XAML markup extensions.

public interface IMarkupExtension
type IMarkupExtension = interface


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}"/>


ProvideValue(IServiceProvider) ProvideValue(IServiceProvider)

Returns the object created from the markup extension.

Applies to