Declined
Last Updated: 22 Mar 2022 16:05 by ADMIN
Daniel
Created on: 22 Mar 2022 15:33
Category: Path
Type: Bug Report
1
Exception Thrown for RadPath

Using the code below, you will find the following exception is thrown:

Happens on Android and Windows (have not tested on iOS/MacCatalyst) using UI for MAUI 0.6.0 running on MAUI preview14

Repro Code

<?xml version="1.0" encoding="utf-8" ?>
<ContentPage ... xmlns:telerikPrimitives="clr-namespace:Telerik.XamarinForms.Primitives;assembly=Telerik.Maui.Controls.Compatibility"
             xmlns:telerikCommon="clr-namespace:Telerik.XamarinForms.Common;assembly=Telerik.Maui.Controls.Compatibility">
    <Grid>
        <Grid WidthRequest="200"
              HeightRequest="200">
            <telerikPrimitives:RadPath x:Name="simpleLinePath"
                                       StrokeThickness="4"
                                       Stroke="#2EC262">
                <telerikCommon:RadPathGeometry>
                    <telerikCommon:RadPathFigure StartPoint="0.8, 0.1">
                        <telerikCommon:RadLineSegment Point="0.1, 0.8" />
                    </telerikCommon:RadPathFigure>
                </telerikCommon:RadPathGeometry>
            </telerikPrimitives:RadPath>
        </Grid>
    </Grid>
</ContentPage>

1 comment
ADMIN
Lance | Senior Manager Technical Support
Posted on: 22 Mar 2022 16:05

Hello Daniel,

This is happening because of a bug in .NET MAUI XAML.  Here is a code example to explain the issue:

<!-- normally works, but is broken in MAUI preview13/14 -->
<SomeControl>
   <SomeContent/>
</SomeControl>

<!-- workaround, explicitly set the property -->
<SomeControl>
    <SomeControl.Content>
       <SomeContent/>
    </SomeControl.Content>
</SomeControl>

 

In the case of the RadPath, the nested XAML content is supposed to be set to the Geometry property of the RadPath. The good news is you do not have to wait for Microsoft to fix this, because you can explicitly set the Geometry property.

Here's a code example with the workaround

<telerikPrimitives:RadPath x:Name="simpleLinePath"
                            StrokeThickness="4"
                            Stroke="#2EC262">
    <telerikPrimitives:RadPath.Geometry>
        <telerikCommon:RadPathGeometry>
            <telerikCommon:RadPathFigure StartPoint="0.8, 0.1">
                <telerikCommon:RadLineSegment Point="0.1, 0.8" />
            </telerikCommon:RadPathFigure>
        </telerikCommon:RadPathGeometry>
    </telerikPrimitives:RadPath.Geometry>
</telerikPrimitives:RadPath>

 

I am going to update the RadPath documentation so that folks can avoid the issue in the future.  That way, you don't have to wait for MAUI fixes to roll out. However, I am closing this Bug Report as Declined because it unrelated to Telerik code and must be repaired by the .NET MAUI team.

Regards,
Lance | Manager Technical Support
Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.