summaryrefslogtreecommitdiff
path: root/Xamarin.Forms.ControlGallery.Android
diff options
context:
space:
mode:
authorMarcus Lum <marcusl@gmail.com>2016-08-30 17:37:07 (GMT)
committerJason Smith <jason.smith@xamarin.com>2016-08-30 17:37:07 (GMT)
commit61f34d113c9f6941194a6ed3101f54158de722a3 (patch)
treeb6211a4e1a4dba6ec40aad3823a795387e851815 /Xamarin.Forms.ControlGallery.Android
parent5b85aafcd671f5e8745cf52339c20378f91cb748 (diff)
downloadxamarin-forms-61f34d113c9f6941194a6ed3101f54158de722a3.zip
xamarin-forms-61f34d113c9f6941194a6ed3101f54158de722a3.tar.gz
xamarin-forms-61f34d113c9f6941194a6ed3101f54158de722a3.tar.bz2
Allow Custom Android MapRenderers to override the default MapView options (#285)
* Allow Custom Android MapRenderers to override the default MapView options * Larger effort to use CreateNativeControl () everywhere instead of just in the Android AppCompat renderers.
Diffstat (limited to 'Xamarin.Forms.ControlGallery.Android')
-rw-r--r--Xamarin.Forms.ControlGallery.Android/CustomRenderers.cs23
1 files changed, 19 insertions, 4 deletions
diff --git a/Xamarin.Forms.ControlGallery.Android/CustomRenderers.cs b/Xamarin.Forms.ControlGallery.Android/CustomRenderers.cs
index 1faa7a9..7f86a85 100644
--- a/Xamarin.Forms.ControlGallery.Android/CustomRenderers.cs
+++ b/Xamarin.Forms.ControlGallery.Android/CustomRenderers.cs
@@ -97,13 +97,18 @@ namespace Xamarin.Forms.ControlGallery.Android
{
}
+ protected override global::Android.Widget.ListView CreateNativeControl()
+ {
+ return new global::Android.Widget.ListView(Forms.Context);
+ }
+
protected override void OnElementChanged(ElementChangedEventArgs<NativeListView> e)
{
base.OnElementChanged(e);
if (Control == null)
{
- SetNativeControl(new global::Android.Widget.ListView(Forms.Context));
+ SetNativeControl(CreateNativeControl());
}
if (e.OldElement != null)
@@ -266,13 +271,18 @@ namespace Xamarin.Forms.ControlGallery.Android
{
}
+ protected override global::Android.Widget.ListView CreateNativeControl()
+ {
+ return new global::Android.Widget.ListView(Forms.Context);
+ }
+
protected override void OnElementChanged(ElementChangedEventArgs<NativeListView2> e)
{
base.OnElementChanged(e);
if (Control == null)
{
- SetNativeControl(new global::Android.Widget.ListView(Forms.Context));
+ SetNativeControl(CreateNativeControl());
}
if (e.OldElement != null)
@@ -406,7 +416,7 @@ namespace Xamarin.Forms.ControlGallery.Android
return view;
}
}
- public class CustomContentRenderer : ViewRenderer
+ public abstract class CustomContentRenderer : ViewRenderer
{
}
@@ -435,11 +445,16 @@ namespace Xamarin.Forms.ControlGallery.Android
public class CustomButtonRenderer : ButtonRenderer
{
+ protected override AButton CreateNativeControl()
+ {
+ return new CustomNativeButton(Context);
+ }
+
protected override void OnElementChanged(ElementChangedEventArgs<Button> e)
{
if (Control == null)
{
- CustomNativeButton b = new CustomNativeButton(Context);
+ CustomNativeButton b = (CustomNativeButton)CreateNativeControl();
SetNativeControl(b);
}