Telerik TabView DataTemplate Problem

1 Answer 92 Views
TabView
ANDRES
Top achievements
Rank 1
ANDRES asked on 31 Oct 2024, 10:36 AM

Hello, I have an issue in .NET MAUI 8.0 with the TabView control in the following code.

<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
             xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
             xmlns:telerik="http://schemas.telerik.com/2022/xaml/maui"
             x:Class="TelerikMauiApp1.MainPage">

    <StackLayout>
        <telerik:RadTabView x:Name="tabView" ItemsSource="{Binding Data}">
            <telerik:RadTabView.ItemTemplate>
                <DataTemplate>
                    <telerik:TabViewItem HeaderText="{Binding Name}">
                        <telerik:TabViewItem.ContentTemplate>
                            <DataTemplate>
                                <telerik:RadItemsControl ItemsSource="{Binding Customers}">
                                    <telerik:RadItemsControl.ItemTemplate>
                                        <DataTemplate>
                                            <Grid>
                                                <telerik:RadBorder BorderColor="LightGray"
                                                           Padding="10"
                                                           Margin="10,5"
                                                           BorderThickness="1" 
                                                           CornerRadius="5">
                                                    <Grid RowDefinitions="Auto, Auto" 
                                                  RowSpacing="5">
                                                        <HorizontalStackLayout Spacing="10">
                                                            <Label Text="&#xe836;"
                                                           FontFamily="TelerikFontExamples" />
                                                            <Label Text="{Binding Name}" />
                                                        </HorizontalStackLayout>
                                                        <HorizontalStackLayout Spacing="10" 
                                                                       Grid.Row="1">
                                                            <Label Text="&#xe85d;" 
                                                           FontFamily="TelerikFontExamples" />
                                                            <Label Text="{Binding Number}" />
                                                        </HorizontalStackLayout>
                                                    </Grid>
                                                </telerik:RadBorder>
                                            </Grid>
                                        </DataTemplate>
                                    </telerik:RadItemsControl.ItemTemplate>
                                </telerik:RadItemsControl>
                            </DataTemplate>
                        </telerik:TabViewItem.ContentTemplate>
                    </telerik:TabViewItem>
                </DataTemplate>
            </telerik:RadTabView.ItemTemplate>

        </telerik:RadTabView>
    </StackLayout>

</ContentPage>

The error I get is: "DataTemplateContent property does not support values of type TabViewItem." Additionally, the tag following the first DataTemplate does not exist.

The version of Telerik I am using is 7.1.0.

1 Answer, 1 is accepted

Sort by
0
Yana
Telerik team
answered on 31 Oct 2024, 02:44 PM

Hello Andres,

This error is a XAML warning and does not affect the app build and run process.  Actually, the dev team already investigated it and the behavior is an issue in the MAUI framework.  We've reported it to the MAUI team:

XAML error is shown when the content of a DataTemplate is not a View

And it is already resolved in the latest version of Visual Studio.  You can upgrade Visual Studio to avoid the warning.  Other than that, if the upgrade is not an option, you should still be able to run the app.

I hope I was of help.

Regards,
Yana
Progress Telerik

Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.

Tags
TabView
Asked by
ANDRES
Top achievements
Rank 1
Answers by
Yana
Telerik team
Share this question
or