new System.ComponentModel.TypeConverterAttribute (typeof (NonExclusiveEnumConverter<NamedSize>))));
}
+ AddCallback(typeof(VisualElement), builder => builder.AddCustomAttributes(
+ "Visual",
+ new System.ComponentModel.TypeConverterAttribute(typeof(VisualDesignTypeConverter))));
+
// TODO: OnPlatform/OnIdiom
// These two should be proper markup extensions, to follow WPF syntax for those.
// That would allow us to turn on XAML validation, which otherwise fails.
// the language service can find the type by its name. That class can be internal
// though, since its visibility in the markup is controlled by the EditorBrowsableAttribute.
// Make OnPlatform/OnIdiom visible for intellisense, and set as markup extension.
- AddCallback (typeof (OnPlatform<>), builder => builder.AddCustomAttributes (new Attribute[] {
+ AddCallback(typeof (OnPlatform<>), builder => builder.AddCustomAttributes (new Attribute[] {
new EditorBrowsableAttribute (EditorBrowsableState.Always),
//new System.ComponentModel.TypeConverterAttribute(typeof(AnythingConverter)),
//new System.Windows.Markup.MarkupExtensionReturnTypeAttribute (),
--- /dev/null
+namespace Xamarin.Forms.Core.Design
+{
+ using System.Collections.Generic;
+ using System.Linq;
+ using System.ComponentModel;
+ using System;
+
+ public class VisualDesignTypeConverter : TypeConverter
+ {
+ public VisualDesignTypeConverter()
+ {
+ }
+
+ protected StandardValuesCollection Values
+ {
+ get;
+ set;
+ }
+
+ public override bool CanConvertFrom(ITypeDescriptorContext context, Type sourceType)
+ {
+ // This tells XAML this converter can be used to process strings
+ // Without this the values won't show up as hints
+ if (sourceType == typeof(string))
+ return true;
+
+ return base.CanConvertFrom(context, sourceType);
+ }
+
+ public override StandardValuesCollection GetStandardValues(ITypeDescriptorContext context)
+ {
+ if(Values == null)
+ {
+ var derivedNames = new List<string>();
+ var baseType = typeof(IVisual);
+
+ var typeElements = typeof(View).Assembly.ExportedTypes.Where(t => baseType.IsAssignableFrom(t) && t.Name != baseType.Name);
+
+ foreach (var typeElement in typeElements)
+ {
+ string name = typeElement.Name;
+ if (name.EndsWith("Visual", StringComparison.OrdinalIgnoreCase))
+ name = name.Substring(0, name.Length - 6);
+
+ derivedNames.Add(name);
+ }
+
+ Values = new StandardValuesCollection(derivedNames);
+ }
+
+ return Values;
+ }
+
+ public override bool GetStandardValuesExclusive(ITypeDescriptorContext context)
+ {
+ return false;
+ }
+
+ public override bool GetStandardValuesSupported(ITypeDescriptorContext context)
+ {
+ return true;
+ }
+ }
+}
\ No newline at end of file
<Compile Include="..\Xamarin.Forms.Core\Properties\GlobalAssemblyInfo.cs">
<Link>Properties\GlobalAssemblyInfo.cs</Link>
</Compile>
+ <Compile Include="VisualDesignTypeConverter.cs" />
</ItemGroup>
<ItemGroup Condition=" '$(OS)' != 'Unix' ">
<Compile Include="AttributeTableBuilder.cs" />
{
protected HandlerAttribute(Type handler, Type target, Type[] supportedVisuals = null)
{
- SupportedVisuals = supportedVisuals ?? new[] { typeof(VisualRendererMarker.Default) };
+ SupportedVisuals = supportedVisuals ?? new[] { typeof(VisualMarker.DefaultVisual) };
TargetType = target;
HandlerType = handler;
}
return null;
}
+ internal static object[] GetCustomAttributesSafe(this Assembly assembly, Type attrType)
+ {
+ object[] attributes = null;
+ try
+ {
+#if NETSTANDARD2_0
+ attributes = assembly.GetCustomAttributes(attrType, true);
+#else
+ attributes = assembly.GetCustomAttributes(attrType).ToArray();
+#endif
+ }
+ catch (System.IO.FileNotFoundException)
+ {
+ // Sometimes the previewer doesn't actually have everything required for these loads to work
+ Log.Warning(nameof(Registrar), "Could not load assembly: {0} for Attribute {1} | Some renderers may not be loaded", assembly.FullName, attrType.FullName);
+ }
+
+ return attributes;
+ }
+
+ public static Type[] GetExportedTypes(this Assembly assembly)
+ {
+ return assembly.ExportedTypes.ToArray();
+ }
+
public static bool IsAssignableFrom(this Type self, Type c)
{
return self.GetTypeInfo().IsAssignableFrom(c.GetTypeInfo());
public class Registrar<TRegistrable> where TRegistrable : class
{
readonly Dictionary<Type, Dictionary<Type, Type>> _handlers = new Dictionary<Type, Dictionary<Type, Type>>();
- static Type _defaultVisualType = typeof(VisualRendererMarker.Default);
- static Type _materialVisualType = typeof(VisualRendererMarker.Material);
+ static Type _defaultVisualType = typeof(VisualMarker.DefaultVisual);
+ static Type _materialVisualType = typeof(VisualMarker.MaterialVisual);
static Type[] _defaultVisualRenderers = new[] { _defaultVisualType };
public sealed class RenderWithAttribute : Attribute
{
- public RenderWithAttribute(Type type) : this(type, new[] { typeof(VisualRendererMarker.Default) })
+ public RenderWithAttribute(Type type) : this(type, new[] { typeof(VisualMarker.DefaultVisual) })
{
}
public RenderWithAttribute(Type type, Type[] supportedVisuals)
{
Type = type;
- SupportedVisuals = supportedVisuals ?? new[] { typeof(VisualRendererMarker.Default) };
+ SupportedVisuals = supportedVisuals ?? new[] { typeof(VisualMarker.DefaultVisual) };
}
public Type[] SupportedVisuals { get; }
+++ /dev/null
-using System;
-
-namespace Xamarin.Forms
-{
- public static class VisualMarker
- {
- static bool _isMaterialRegistered = false;
- static bool _warnedAboutMaterial = false;
-
- public static IVisual MatchParent { get; } = new VisualRendererMarker.MatchParent();
- public static IVisual Default { get; } = new VisualRendererMarker.Default();
- public static IVisual Material { get; } = new VisualRendererMarker.Material();
-
- internal static void RegisterMaterial() => _isMaterialRegistered = true;
- internal static void MaterialCheck()
- {
- if (_isMaterialRegistered || _warnedAboutMaterial)
- return;
-
- _warnedAboutMaterial = true;
- if (Device.RuntimePlatform == Device.iOS)
- Internals.Log.Warning("Visual", "Material needs to be registered on iOS by calling FormsMaterial.Init() after the Xamarin.Forms.Forms.Init method call.");
- else if (Device.RuntimePlatform != Device.Android)
- Internals.Log.Warning("Visual", $"Material is currently not support on {Device.RuntimePlatform}.");
- }
- }
-
- public static class VisualRendererMarker
- {
- public sealed class Material : IVisual { internal Material() { } }
- public sealed class Default : IVisual { internal Default() { } }
- internal sealed class MatchParent : IVisual { internal MatchParent() { } }
- }
-
- [TypeConverter(typeof(VisualTypeConverter))]
- public interface IVisual
- {
-
- }
-
- [Xaml.TypeConversion(typeof(IVisual))]
- public class VisualTypeConverter : TypeConverter
- {
- public override object ConvertFromInvariantString(string value)
- {
- if (value != null)
- {
- var sc = StringComparison.OrdinalIgnoreCase;
- if (value.Equals(nameof(VisualMarker.MatchParent), sc))
- return VisualMarker.MatchParent;
- else if (value.Equals(nameof(VisualMarker.Material), sc))
- return VisualMarker.Material;
- else
- return VisualMarker.Default;
- }
- throw new InvalidOperationException($"Cannot convert \"{value}\" into {typeof(IVisual)}");
- }
- }
-}
\ No newline at end of file
--- /dev/null
+namespace Xamarin.Forms
+{
+ [TypeConverter(typeof(VisualTypeConverter))]
+ public interface IVisual
+ {
+ }
+}
\ No newline at end of file
--- /dev/null
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace Xamarin.Forms
+{
+ [AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
+ public class VisualAttribute : Attribute
+ {
+ public VisualAttribute(string key, Type visual)
+ {
+ this.Key = key;
+ this.Visual = visual;
+ }
+
+ internal string Key { get; }
+ internal Type Visual { get; }
+ }
+}
--- /dev/null
+namespace Xamarin.Forms
+{
+ public static class VisualMarker
+ {
+ static bool _isMaterialRegistered = false;
+ static bool _warnedAboutMaterial = false;
+
+ public static IVisual MatchParent { get; } = new MatchParentVisual();
+ public static IVisual Default { get; } = new DefaultVisual();
+ public static IVisual Material { get; } = new MaterialVisual();
+
+ internal static void RegisterMaterial() => _isMaterialRegistered = true;
+ internal static void MaterialCheck()
+ {
+ if (_isMaterialRegistered || _warnedAboutMaterial)
+ return;
+
+ _warnedAboutMaterial = true;
+ if (Device.RuntimePlatform == Device.iOS)
+ Internals.Log.Warning("Visual", "Material needs to be registered on iOS by calling FormsMaterial.Init() after the Xamarin.Forms.Forms.Init method call.");
+ else if (Device.RuntimePlatform != Device.Android)
+ Internals.Log.Warning("Visual", $"Material is currently not support on {Device.RuntimePlatform}.");
+ }
+
+
+ public sealed class MaterialVisual : IVisual { public MaterialVisual() { } }
+ public sealed class DefaultVisual : IVisual { public DefaultVisual() { } }
+ internal sealed class MatchParentVisual : IVisual { public MatchParentVisual() { } }
+ }
+}
\ No newline at end of file
--- /dev/null
+using System;
+using System.Collections.Generic;
+using System.Reflection;
+using Xamarin.Forms.Internals;
+using Xamarin.Forms.Xaml;
+
+namespace Xamarin.Forms
+{
+ [Xaml.TypeConversion(typeof(IVisual))]
+ public class VisualTypeConverter : TypeConverter
+ {
+ static Dictionary<string, IVisual> _visualTypeMappings;
+ void InitMappings()
+ {
+ var mappings = new Dictionary<string, IVisual>(StringComparer.OrdinalIgnoreCase);
+ Assembly[] assemblies = Device.GetAssemblies();
+
+ // Check for IVisual Types
+ foreach (var assembly in assemblies)
+ Register(assembly, mappings);
+
+ if (Internals.Registrar.ExtraAssemblies != null)
+ foreach (var assembly in Internals.Registrar.ExtraAssemblies)
+ Register(assembly, mappings);
+
+
+ // Check for visual assembly attributes after scanning for IVisual Types
+ // this will let users replace the default visual names if they want to
+ foreach (var assembly in assemblies)
+ RegisterFromAttributes(assembly, mappings);
+
+ if (Internals.Registrar.ExtraAssemblies != null)
+ foreach (var assembly in Internals.Registrar.ExtraAssemblies)
+ RegisterFromAttributes(assembly, mappings);
+
+ _visualTypeMappings = mappings;
+ }
+
+ static void RegisterFromAttributes(Assembly assembly, Dictionary<string, IVisual> mappings)
+ {
+ object[] attributes = assembly.GetCustomAttributesSafe(typeof(VisualAttribute));
+
+ if (attributes != null)
+ {
+ foreach (VisualAttribute attribute in attributes)
+ {
+ var visual = CreateVisual(attribute.Visual);
+ if (visual != null)
+ mappings[attribute.Key] = visual;
+ }
+ }
+ }
+
+ static void Register(Assembly assembly, Dictionary<string, IVisual> mappings)
+ {
+ foreach (var type in assembly.GetExportedTypes())
+ if (typeof(IVisual).IsAssignableFrom(type) && type != typeof(IVisual))
+ Register(type, mappings);
+ }
+
+ static void Register(Type visual, Dictionary<string, IVisual> mappings)
+ {
+ IVisual registeredVisual = CreateVisual(visual);
+ if (registeredVisual == null)
+ return;
+
+ string name = visual.Name;
+ string fullName = visual.FullName;
+
+ if (name.EndsWith("Visual", StringComparison.OrdinalIgnoreCase))
+ {
+ name = name.Substring(0, name.Length - 6);
+ fullName = fullName.Substring(0, fullName.Length - 6);
+ }
+
+ mappings[name] = registeredVisual;
+ mappings[fullName] = registeredVisual;
+ mappings[$"{name}Visual"] = registeredVisual;
+ mappings[$"{fullName}Visual"] = registeredVisual;
+
+ }
+
+ static IVisual CreateVisual(Type visualType)
+ {
+ try
+ {
+ return (IVisual)Activator.CreateInstance(visualType);
+ }
+ catch
+ {
+ Internals.Log.Warning("Visual", $"Unable to register {visualType} please add a public default constructor");
+ }
+
+ return null;
+ }
+
+ public override object ConvertFromInvariantString(string value)
+ {
+ if (_visualTypeMappings == null)
+ InitMappings();
+
+ if (value != null)
+ {
+ IVisual returnValue = null;
+ if (_visualTypeMappings.TryGetValue(value, out returnValue))
+ return returnValue;
+
+ return VisualMarker.Default;
+ }
+
+ throw new XamlParseException($"Cannot convert \"{value}\" into {typeof(IVisual)}");
+ }
+ }
+}
\ No newline at end of file
using CoreGraphics;
using MaterialComponents;
using UIKit;
-using Xamarin.Forms;
using MButton = MaterialComponents.Button;
-[assembly: ExportRenderer(typeof(Xamarin.Forms.Stepper), typeof(Xamarin.Forms.Platform.iOS.Material.MaterialStepperRenderer), new[] { typeof(VisualRendererMarker.Material) })]
-
namespace Xamarin.Forms.Platform.iOS.Material
{
public class MaterialStepperRenderer : ViewRenderer<Stepper, MaterialStepper>
[assembly: AssemblyVersion("2.0.0.0")]
[assembly: AssemblyFileVersion("2.0.0.0")]
-[assembly: ExportRenderer(typeof(Xamarin.Forms.ActivityIndicator), typeof(Xamarin.Forms.Platform.iOS.Material.MaterialActivityIndicatorRenderer), new[] { typeof(VisualRendererMarker.Material) })]
-[assembly: ExportRenderer(typeof(Xamarin.Forms.Button), typeof(Xamarin.Forms.Platform.iOS.Material.MaterialButtonRenderer), new[] { typeof(VisualRendererMarker.Material) })]
-[assembly: ExportRenderer(typeof(Xamarin.Forms.Entry), typeof(Xamarin.Forms.Platform.iOS.Material.MaterialEntryRenderer), new[] { typeof(VisualRendererMarker.Material) })]
-[assembly: ExportRenderer(typeof(Xamarin.Forms.Frame), typeof(Xamarin.Forms.Platform.iOS.Material.MaterialFrameRenderer), new[] { typeof(VisualRendererMarker.Material) })]
-[assembly: ExportRenderer(typeof(Xamarin.Forms.ProgressBar), typeof(Xamarin.Forms.Platform.iOS.Material.MaterialProgressBarRenderer), new[] { typeof(VisualRendererMarker.Material) })]
-[assembly: ExportRenderer(typeof(Xamarin.Forms.Slider), typeof(Xamarin.Forms.Platform.iOS.Material.MaterialSliderRenderer), new[] { typeof(VisualRendererMarker.Material) })]
-[assembly: ExportRenderer(typeof(Xamarin.Forms.TimePicker), typeof(Xamarin.Forms.Platform.iOS.Material.MaterialTimePickerRenderer), new[] { typeof(VisualRendererMarker.Material) })]
-[assembly: ExportRenderer(typeof(Xamarin.Forms.Picker), typeof(Xamarin.Forms.Platform.iOS.Material.MaterialPickerRenderer), new[] { typeof(VisualRendererMarker.Material) })]
-[assembly: ExportRenderer(typeof(Xamarin.Forms.DatePicker), typeof(Xamarin.Forms.Platform.iOS.Material.MaterialDatePickerRenderer), new[] { typeof(VisualRendererMarker.Material) })]
\ No newline at end of file
+[assembly: ExportRenderer(typeof(Xamarin.Forms.ActivityIndicator), typeof(Xamarin.Forms.Platform.iOS.Material.MaterialActivityIndicatorRenderer), new[] { typeof(VisualMarker.MaterialVisual) })]
+[assembly: ExportRenderer(typeof(Xamarin.Forms.Button), typeof(Xamarin.Forms.Platform.iOS.Material.MaterialButtonRenderer), new[] { typeof(VisualMarker.MaterialVisual) })]
+[assembly: ExportRenderer(typeof(Xamarin.Forms.Entry), typeof(Xamarin.Forms.Platform.iOS.Material.MaterialEntryRenderer), new[] { typeof(VisualMarker.MaterialVisual) })]
+[assembly: ExportRenderer(typeof(Xamarin.Forms.Frame), typeof(Xamarin.Forms.Platform.iOS.Material.MaterialFrameRenderer), new[] { typeof(VisualMarker.MaterialVisual) })]
+[assembly: ExportRenderer(typeof(Xamarin.Forms.ProgressBar), typeof(Xamarin.Forms.Platform.iOS.Material.MaterialProgressBarRenderer), new[] { typeof(VisualMarker.MaterialVisual) })]
+[assembly: ExportRenderer(typeof(Xamarin.Forms.Slider), typeof(Xamarin.Forms.Platform.iOS.Material.MaterialSliderRenderer), new[] { typeof(VisualMarker.MaterialVisual) })]
+[assembly: ExportRenderer(typeof(Xamarin.Forms.TimePicker), typeof(Xamarin.Forms.Platform.iOS.Material.MaterialTimePickerRenderer), new[] { typeof(VisualMarker.MaterialVisual) })]
+[assembly: ExportRenderer(typeof(Xamarin.Forms.Picker), typeof(Xamarin.Forms.Platform.iOS.Material.MaterialPickerRenderer), new[] { typeof(VisualMarker.MaterialVisual) })]
+[assembly: ExportRenderer(typeof(Xamarin.Forms.DatePicker), typeof(Xamarin.Forms.Platform.iOS.Material.MaterialDatePickerRenderer), new[] { typeof(VisualMarker.MaterialVisual) })]
+[assembly: ExportRenderer(typeof(Xamarin.Forms.Stepper), typeof(Xamarin.Forms.Platform.iOS.Material.MaterialStepperRenderer), new[] { typeof(VisualMarker.MaterialVisual) })]
\ No newline at end of file
using AProgressBar = Android.Widget.ProgressBar;
using AView = Android.Views.View;
-[assembly: ExportRenderer(typeof(ActivityIndicator), typeof(MaterialActivityIndicatorRenderer), new[] { typeof(VisualRendererMarker.Material) })]
+[assembly: ExportRenderer(typeof(ActivityIndicator), typeof(MaterialActivityIndicatorRenderer), new[] { typeof(VisualMarker.MaterialVisual) })]
namespace Xamarin.Forms.Platform.Android.Material
{
using AView = Android.Views.View;
using MButton = Android.Support.Design.Button.MaterialButton;
-[assembly: ExportRenderer(typeof(Xamarin.Forms.Button), typeof(MaterialButtonRenderer), new[] { typeof(VisualRendererMarker.Material) })]
+[assembly: ExportRenderer(typeof(Xamarin.Forms.Button), typeof(MaterialButtonRenderer), new[] { typeof(VisualMarker.MaterialVisual) })]
namespace Xamarin.Forms.Platform.Android.Material
{
using Xamarin.Forms;
using Xamarin.Forms.Platform.Android.Material;
-[assembly: ExportRenderer(typeof(Xamarin.Forms.DatePicker), typeof(MaterialDatePickerRenderer), new[] { typeof(VisualRendererMarker.Material) })]
+[assembly: ExportRenderer(typeof(Xamarin.Forms.DatePicker), typeof(MaterialDatePickerRenderer), new[] { typeof(VisualMarker.MaterialVisual) })]
namespace Xamarin.Forms.Platform.Android.Material
{
using Xamarin.Forms;
using Xamarin.Forms.Platform.Android.Material;
-[assembly: ExportRenderer(typeof(Xamarin.Forms.Entry), typeof(MaterialEntryRenderer), new[] { typeof(VisualRendererMarker.Material) })]
+[assembly: ExportRenderer(typeof(Xamarin.Forms.Entry), typeof(MaterialEntryRenderer), new[] { typeof(VisualMarker.MaterialVisual) })]
namespace Xamarin.Forms.Platform.Android.Material
{
public sealed class MaterialEntryRenderer : EntryRendererBase<MaterialFormsTextInputLayout>
using AView = Android.Views.View;
using MaterialCardView = Android.Support.Design.Card.MaterialCardView;
-[assembly: ExportRenderer(typeof(Xamarin.Forms.Frame), typeof(MaterialFrameRenderer), new[] { typeof(VisualRendererMarker.Material) })]
+[assembly: ExportRenderer(typeof(Xamarin.Forms.Frame), typeof(MaterialFrameRenderer), new[] { typeof(VisualMarker.MaterialVisual) })]
namespace Xamarin.Forms.Platform.Android.Material
{
using Xamarin.Forms;
using Xamarin.Forms.Platform.Android.Material;
-[assembly: ExportRenderer(typeof(Xamarin.Forms.Picker), typeof(MaterialPickerRenderer), new[] { typeof(VisualRendererMarker.Material) })]
+[assembly: ExportRenderer(typeof(Xamarin.Forms.Picker), typeof(MaterialPickerRenderer), new[] { typeof(VisualMarker.MaterialVisual) })]
namespace Xamarin.Forms.Platform.Android.Material
{
using AProgressBar = Android.Widget.ProgressBar;
using AView = Android.Views.View;
-[assembly: ExportRenderer(typeof(ProgressBar), typeof(MaterialProgressBarRenderer), new[] { typeof(VisualRendererMarker.Material) })]
+[assembly: ExportRenderer(typeof(ProgressBar), typeof(MaterialProgressBarRenderer), new[] { typeof(VisualMarker.MaterialVisual) })]
namespace Xamarin.Forms.Platform.Android.Material
{
using Xamarin.Forms.Platform.Android.Material;
using AView = Android.Views.View;
-[assembly: ExportRenderer(typeof(Xamarin.Forms.Slider), typeof(MaterialSliderRenderer), new[] { typeof(VisualRendererMarker.Material) })]
+[assembly: ExportRenderer(typeof(Xamarin.Forms.Slider), typeof(MaterialSliderRenderer), new[] { typeof(VisualMarker.MaterialVisual) })]
namespace Xamarin.Forms.Platform.Android.Material
{
using AButton = Android.Widget.Button;
using MButton = Android.Support.Design.Button.MaterialButton;
-[assembly: ExportRenderer(typeof(Xamarin.Forms.Stepper), typeof(MaterialStepperRenderer), new[] { typeof(VisualRendererMarker.Material) })]
+[assembly: ExportRenderer(typeof(Xamarin.Forms.Stepper), typeof(MaterialStepperRenderer), new[] { typeof(VisualMarker.MaterialVisual) })]
namespace Xamarin.Forms.Platform.Android.Material
{
using Xamarin.Forms;
using Xamarin.Forms.Platform.Android.Material;
-[assembly: ExportRenderer(typeof(Xamarin.Forms.TimePicker), typeof(MaterialTimePickerRenderer), new[] { typeof(VisualRendererMarker.Material) })]
+[assembly: ExportRenderer(typeof(Xamarin.Forms.TimePicker), typeof(MaterialTimePickerRenderer), new[] { typeof(VisualMarker.MaterialVisual) })]
namespace Xamarin.Forms.Platform.Android.Material
{
[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
public sealed class ExportRendererAttribute : HandlerAttribute
{
- public ExportRendererAttribute(Type handler, Type target) : base(handler, target)
+ public ExportRendererAttribute(Type handler, Type target) : this(handler, target, null)
+ {
+ }
+
+ public ExportRendererAttribute(Type handler, Type target, Type[] supportedVisuals) : base(handler, target, supportedVisuals)
{
}
}
[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
public sealed class ExportRendererAttribute : HandlerAttribute
{
- public ExportRendererAttribute(Type handler, Type target) : base(handler, target)
+ public ExportRendererAttribute(Type handler, Type target) : this(handler, target, null)
+ {
+ }
+
+ public ExportRendererAttribute(Type handler, Type target, Type[] supportedVisuals) : base(handler, target, supportedVisuals)
{
}
}
[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
public sealed class ExportRendererAttribute : HandlerAttribute
{
- public ExportRendererAttribute(Type handler, Type target) : base(handler, target)
+ public ExportRendererAttribute(Type handler, Type target) : this(handler, target, null)
+ {
+ }
+
+ public ExportRendererAttribute(Type handler, Type target, Type[] supportedVisuals) : base(handler, target, supportedVisuals)
{
}
}
[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
public sealed class ExportRendererAttribute : HandlerAttribute
{
- public ExportRendererAttribute(Type handler, Type target) : base(handler, target)
+ public ExportRendererAttribute(Type handler, Type target) : this(handler, target, null)
+ {
+ }
+
+ public ExportRendererAttribute(Type handler, Type target, Type[] supportedVisuals) : base(handler, target, supportedVisuals)
{
}
}
// This code is called from the App Constructor so just initialize the main page of the application here
void InitializeMainPage()
{
- MainPage = new ContentPage()
+ /*MainPage = new ContentPage()
{
Content = CreateStackLayout(new[] { new Button() { Text = "text" } })
};
+ MainPage.Visual = VisualMarker.Material;*/
+ MainPage = new MainPage();
}
}
}
--- /dev/null
+<?xml version="1.0" encoding="utf-8" ?>
+<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
+ xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
+ x:Class="Xamarin.Forms.Sandbox.MainPage">
+ <ContentPage.Content>
+ <StackLayout>
+ <Button Text="Material text" Visual="MaTeRiAl" />
+ </StackLayout>
+ </ContentPage.Content>
+</ContentPage>
\ No newline at end of file
--- /dev/null
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+using Xamarin.Forms;
+using Xamarin.Forms.Xaml;
+
+namespace Xamarin.Forms.Sandbox
+{
+ [XamlCompilation(XamlCompilationOptions.Compile)]
+ public partial class MainPage : ContentPage
+ {
+ public MainPage()
+ {
+ InitializeComponent();
+ }
+ }
+}
\ No newline at end of file