UWP: Add a ExtendedTableViewRenderer (#260)

Add a base ExtendedTableViewRenderer we can use.

Signed-off-by: Alistair Francis <alistair@alistair23.me>
This commit is contained in:
Alistair Francis 2018-01-19 11:04:58 -08:00 committed by Kyle Spearrin
parent 41efa96291
commit 592c7951df
3 changed files with 31 additions and 1 deletions

View file

@ -49,7 +49,8 @@ namespace Bit.UWP
var assembliesToInclude = new List<Assembly>()
{
typeof(CachedImage).GetTypeInfo().Assembly,
typeof(CachedImageRenderer).GetTypeInfo().Assembly
typeof(CachedImageRenderer).GetTypeInfo().Assembly,
typeof(Controls.ExtendedTableViewRenderer).GetTypeInfo().Assembly
};
Xamarin.Forms.Forms.Init(e, assembliesToInclude);

View file

@ -0,0 +1,28 @@
using System;
using System.ComponentModel;
using Bit.App.Controls;
using Bit.UWP.Controls;
using Xamarin.Forms;
using Xamarin.Forms.Platform.UWP;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
[assembly: ExportRenderer(typeof(ExtendedTableView), typeof(ExtendedTableViewRenderer))]
namespace Bit.UWP.Controls
{
public class ExtendedTableViewRenderer : TableViewRenderer
{
public override SizeRequest GetDesiredSize(double widthConstraint, double heightConstraint)
{
var baseSize = new Size(Control.Width, Control.Height);
return new SizeRequest(new Size(baseSize.Width, baseSize.Height));
}
protected override void OnElementChanged(ElementChangedEventArgs<TableView> e)
{
base.OnElementChanged(e);
}
}
}

View file

@ -95,6 +95,7 @@
<Compile Include="App.xaml.cs">
<DependentUpon>App.xaml</DependentUpon>
</Compile>
<Compile Include="Controls\ExtendedTableViewRenderer.cs" />
<Compile Include="IconConverter.cs" />
<Compile Include="MainPage.xaml.cs">
<DependentUpon>MainPage.xaml</DependentUpon>