Quantcast
Channel: Xamarin.Forms — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 58056

Custom renderer not working on device

$
0
0

I have been following http://developer.xamarin.com/guides/cross-platform/xamarin-forms/custom-renderer/
Custom renderer works fine on the iphone simulator but when i deploy to device it will not load and crash

`[assembly: ExportRendererAttribute(typeof(ExtendedEntryCell), typeof(ExtendedEntryCellRenderer))]
namespace app.iOS
{
public class ExtendedEntryCellRenderer : EntryCellRenderer
{
public ExtendedEntryCellRenderer ()
{
}

    public override UITableViewCell GetCell(Cell item, UITableView tv)
    {
        //var extendedCell = (ExtendedTextCell)item;
        var cell = base.GetCell (item, tv);
        if (cell != null) {
            cell.BackgroundColor = UIColor.Clear;
            //cell.SelectedBackgroundView = new UIView{BackgroundColor = extendedCell.SelectColor.ToUIColor()};

        }
        //tv.SeparatorColor = extendedCell.SeparatorColor.ToUIColor();
        //tv.SeparatorColor = UIColor.FromRGB (11, 38, 59);

        return cell;
    }
}

}
`

`
namespace app.core
{
public class ExtendedTextCell : TextCell
{
public ExtendedTextCell()
{
}

    public static readonly BindableProperty SeparatorColorProperty =
        BindableProperty.Create<ExtendedTextCell, Color>(p => p.SeparatorColor, Color.White);

    public Color SeparatorColor
    {
        get { return (Color)GetValue(SeparatorColorProperty); }
        set { SetValue(SeparatorColorProperty, value); }
    }

    public static readonly BindableProperty SelectColorProperty =
        BindableProperty.Create<ExtendedTextCell, Color>(p => p.SelectColor, Color.FromHex("#d9d9d9"));

    public Color SelectColor
    {
        get { return (Color)GetValue(SelectColorProperty); }
        set { SetValue(SelectColorProperty, value); }
    }
}

}
`

<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
                       xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
                       x:Class="m.transport.UI.About"
                       xmlns:local="clr-namespace:app.core;assembly=app.core"
                       Title="demo">
    <TableView BackgroundColor="#cae5ee">
        <TableView.Root>
            <TableSection>
                <local:ExtendedTextCell StyleId="appVersion" Text="Type"
                           Detail="{Binding VersionType}"/>
            </TableSection>
        </TableView.Root>
    </TableView>
</ContentPage>

Any suggestions?


Viewing all articles
Browse latest Browse all 58056

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>