Declined
Last Updated: 31 Aug 2021 13:12 by Tom
Brian
Created on: 18 Jun 2019 16:43
Category: ListView
Type: Bug Report
2
Telerik.XamarinForms.Common.NotRegisteredRendererException

When using a RadListview with a Grid or a Stack Layout in iOS I get the following exception. I haven't tested using the stacklayout outside of the RadListView nor have I tested it outside of the ItemTemplateSelector


Telerik.XamarinForms.Common.NotRegisteredRendererException: There is no renderer registered for the specified type: Xamarin.Forms.Grid
It works fine on Android. Below is the xaml I'm using.


<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
             xmlns:telerikDataControls="clr-namespace:Telerik.XamarinForms.DataControls;assembly=Telerik.XamarinForms.DataControls"
             xmlns:telerikListView="clr-namespace:Telerik.XamarinForms.DataControls.ListView;assembly=Telerik.XamarinForms.DataControls"
             xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
             xmlns:d="http://xamarin.com/schemas/2014/forms/design"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
             xmlns:models="clr-namespace:AlertTest.Models"
             mc:Ignorable="d"
             xmlns:views="clr-namespace:AlertTest.Views"
             x:Class="AlertTest.Views.MainPage">
    <ContentPage.Resources>
        <ResourceDictionary>
            <DataTemplate x:Key="NonDivisibleTemplate">
                <Grid>
                    <StackLayout Orientation="Vertical" Padding="10" Spacing="0" BackgroundColor="Yellow" InputTransparent="True" Unfocused="StackLayout_Unfocused">
                        <Label Text="{Binding ItemText}"/>
                    </StackLayout>
            </DataTemplate>
            <DataTemplate x:Key="DivisibleTemplate">
                <Grid>
                    <StackLayout Orientation="Vertical" Padding="15" Spacing="0" BackgroundColor="White" Unfocused="StackLayout_Unfocused">
                        <Label Text="{Binding ItemText}" FontSize="Large" HorizontalTextAlignment="Center"/>
                        <Label Text="{Binding ItemText}" FontSize="Small" FontAttributes="Italic" TextColor="Gray"/>
                    </StackLayout>
                </Grid>
            </DataTemplate>

            <models:MyDataTemplateSelector
                x:Key="MyTemplateSelector"
                NonDivisibleTemplate="{StaticResource NonDivisibleTemplate}"
                DivisibleTemplate="{StaticResource DivisibleTemplate}" />
        </ResourceDictionary>
    </ContentPage.Resources>

    <StackLayout VerticalOptions="StartAndExpand">
        <!-- Place new controls here -->
        <views:FloatingLabelEntry EntryText="{Binding EntryText}" Margin="20" BackgroundColor="Yellow" PlaceholderText="{Binding PlaceholderText}"/>
        <Entry TextChanged="Entry_TextChanged" BackgroundColor="AliceBlue" Margin="20"/>
        <telerikDataControls:RadListView x:Name="listView" ItemsSource="{Binding ListItems}" ItemTemplateSelector="{StaticResource MyTemplateSelector}" SelectionMode="Single" IsItemSwipeEnabled="False" >
            <!--<telerikDataControls:RadListView.ItemSwipeContentTemplate>
                <DataTemplate>
                    -->
            <!--<Grid Margin="0"
                  Padding="0"
                  ColumnSpacing="0"
                  RowSpacing="0">-->
            <!--<Grid.ColumnDefinitions>
                            <ColumnDefinition Width="*" />
                            <ColumnDefinition Width="*" />
                        </Grid.ColumnDefinitions>-->
            <!--
                    <StackLayout Orientation="Horizontal" HorizontalOptions="FillAndExpand">
                        <Label BackgroundColor="#2474d2"
                       HorizontalTextAlignment="Start"
                               HorizontalOptions="StartAndExpand"
                       Text="Mark as read"
                       TextColor="White"
                       VerticalTextAlignment="Center" />
                        <Label Grid.Column="2"
                       BackgroundColor="Red"
                       HorizontalTextAlignment="End"
                               HorizontalOptions="EndAndExpand"
                       Text="delete"
                       TextColor="White"
                       VerticalTextAlignment="Center"/>
                    </StackLayout>
                    -->
            <!--</Grid>-->
            <!--
                </DataTemplate>
            </telerikDataControls:RadListView.ItemSwipeContentTemplate>-->
        </telerikDataControls:RadListView>
    </StackLayout>
</ContentPage>

7 comments
Tom
Posted on: 31 Aug 2021 13:12

Hello, I had several templates. One of them looked like this and I was getting a renderer exception for SearchView (a custom Grid-based view class) on iOS only as described in this thread.

    <tk:RadListView.ItemTemplate>
        <DataTemplate>                        
            <ivv:SearchView/>
        </DataTemplate>
    </tk:RadListView.ItemTemplate>

Lance's first comment helped me catch my omission and put my life on the right path. 

    <tk:RadListView.ItemTemplate>
        <DataTemplate>
            <tklist:ListViewTemplateCell>
                <tklist:ListViewTemplateCell.View>
                    <ivv:SearchView/>
                </tklist:ListViewTemplateCell.View>
            </tklist:ListViewTemplateCell>
        </DataTemplate>
    </tk:RadListView.ItemTemplate>

This made the exception go away.

 

           
ADMIN
Lance | Manager Technical Support
Posted on: 15 May 2020 19:03

Hello Michael,

You're missing the ListViewTemplateCell parent, visit the RadListView - Cell Types documentation for an example.

Regards,
Lance | Team Lead - US DevTools Support
Progress Telerik

Progress is here for your business, like always. Read more about the measures we are taking to ensure business continuity and help fight the COVID-19 pandemic.
Our thoughts here at Progress are with those affected by the outbreak.
Michael Blanchet
Posted on: 15 May 2020 18:46

I was getting the same error, but only on iOS. I was using a RadListView with the following ItemTemplate

            <telerikDataControls:RadListView.ItemTemplate>
              <DataTemplate>
                <StackLayout Padding="15,0,0,0" HorizontalOptions="StartAndExpand" HeightRequest="20" Orientation="Horizontal">
                  <Label Text="{Binding ProductOptionsGroupID}" IsVisible="False"/>
                  <Label Text="{Binding ProductOptionsGroupName}" IsVisible="True" FontSize="{x:Static local:FontSize.FNSmall}" TextColor="DarkBlue" FontAttributes="Bold"/>
                  <Label Text="|" IsVisible="True" FontSize="Default" TextColor="Red"/>
                  <Label Text="{Binding OptionChoice}" IsVisible="True" FontSize="{x:Static local:FontSize.FNSmall}" TextColor="Green" FontAttributes="None"/>
                </StackLayout>
              </DataTemplate>
            </telerikDataControls:RadListView.ItemTemplate>

It runs fine on Android. I have changed to a Grid and it works fine on both Android and iOS

ADMIN
Lance | Manager Technical Support
Posted on: 19 Sep 2019 14:17

Hello,

I have marked this Bug Report Declined due to inactivity (i.e. not reproducible with no further reported instances). If the issue re-appears in the future for anyone, feel free to post a reply for us to reconsider the issue.

Regards,
Lance | Technical Support Engineer, Principal
Progress Telerik

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
ADMIN
Lance | Manager Technical Support
Posted on: 20 Jun 2019 21:11
Hello Brian,

This may not be a bug, it could instead be related to problematic behavior when you use a UI virtualized component inside a StackLayout. Please take a look at this Troubleshooting Article on how you can fix the layout for that page.

In terms of your page, do not use a StackLayout as the page root (I personally think it's bad idea that Microsoft has it in the page template to begin with). Instead use a Grid or other layout panel that does not squeeze the children to the minimum amount of space.

Here's your code with the recommended root layout:

<ContentPage ...>
     ...
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="*"/>
        </Grid.RowDefinitions>
     
        <views:FloatingLabelEntry Grid.Row="0" .../>
         
        <Entry Grid.Row="1" .../>
         
        <telerikDataControls:RadListView Grid.Row="2" .../>
    </Grid>
</ContentPage>


To summarize the issue, StackLayout measures its children's height to infinity. This will break any child that needs a layout pass measurement to render the items (in this case, the RadListView when trying to render the TemplateSelector's chosen template).

This is why using a RowDefinition with a Height of star prevents the potential issue. the star-sizing will fill the available remainder of the space on the page that isn't being used by the Auto-sized rows. Note that auto sized row does the same thing as a StackLayout, so you don't want to put the RadListView in an auto-sized row either.

I hope this helps. If you do see the problem again, feel free to reply

Regards,
Lance | Technical Support Engineer, Principal
Progress Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Brian
Posted on: 18 Jun 2019 18:01
Ok this is still an issue, even with that declaration removed I'm still getting the error, which means it is intermittent.
Brian
Posted on: 18 Jun 2019 17:47

I figured out the issue here, it was because I had the following xmlns declaration in addition to the DataControls one.

 

             xmlns:telerikListView="clr-namespace:Telerik.XamarinForms.DataControls.ListView;assembly=Telerik.XamarinForms.DataControls"