Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Xamarin.Forms Markup Extension Example
[ContentProperty("FriendlyName")]
public class FriendlyThickness : IMarkupExtension
{
public FriendlyThickness()
{
}
public string FriendlyName { get; set; }
public object ProvideValue(IServiceProvider serviceProvider)
{
switch (FriendlyName?.ToLower())
{
case "fatleft":
return new Thickness(50, 0, 0, 0);
case "fatright":
return new Thickness(0, 0, 50, 0);
case "skinnytop":
return new Thickness(0, 10, 0, 0);
case "skinnybottom":
return new Thickness(0, 0, 0, 10);
default:
return new Thickness();
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.