summaryrefslogtreecommitdiff
path: root/Xamarin.Forms.Platform.Android/Renderers/TableViewRenderer.cs
diff options
context:
space:
mode:
Diffstat (limited to 'Xamarin.Forms.Platform.Android/Renderers/TableViewRenderer.cs')
-rw-r--r--Xamarin.Forms.Platform.Android/Renderers/TableViewRenderer.cs44
1 files changed, 44 insertions, 0 deletions
diff --git a/Xamarin.Forms.Platform.Android/Renderers/TableViewRenderer.cs b/Xamarin.Forms.Platform.Android/Renderers/TableViewRenderer.cs
new file mode 100644
index 00000000..e4017a7e
--- /dev/null
+++ b/Xamarin.Forms.Platform.Android/Renderers/TableViewRenderer.cs
@@ -0,0 +1,44 @@
+using Android.Views;
+using AView = Android.Views.View;
+using AListView = Android.Widget.ListView;
+
+namespace Xamarin.Forms.Platform.Android
+{
+ public class TableViewRenderer : ViewRenderer<TableView, AListView>
+ {
+ public TableViewRenderer()
+ {
+ AutoPackage = false;
+ }
+
+ protected virtual TableViewModelRenderer GetModelRenderer(AListView listView, TableView view)
+ {
+ return new TableViewModelRenderer(Context, listView, view);
+ }
+
+ protected override Size MinimumSize()
+ {
+ return new Size(40, 40);
+ }
+
+ protected override void OnElementChanged(ElementChangedEventArgs<TableView> e)
+ {
+ base.OnElementChanged(e);
+
+ AListView listView = Control;
+ if (listView == null)
+ {
+ listView = new AListView(Context);
+ SetNativeControl(listView);
+ }
+
+ listView.Focusable = false;
+ listView.DescendantFocusability = DescendantFocusability.AfterDescendants;
+
+ TableView view = e.NewElement;
+
+ TableViewModelRenderer source = GetModelRenderer(listView, view);
+ listView.Adapter = source;
+ }
+ }
+} \ No newline at end of file