How to get the default style for items in a TreeView?

1 Answer 33 Views
TreeView
Jonathan
Top achievements
Rank 1
Jonathan asked on 26 Feb 2025, 11:46 AM

Hi,

I have a project in .NET 9 and I'm using Telerik 10.0.0, I'm trying to display a TreeView with the default style, but I only have the text displayed.

Here is the XAML code:

<telerik:RadTreeView Grid.Row="1"
                        ItemsSource="{Binding Catalog.Children}"
                        BackgroundColor="#FFFFFF"
                        ItemTapped="OnTreeItemTapped"
                        LoadChildrenOnDemandCommand="{Binding LoadOnDemandCommand}"
                        VerticalOptions="FillAndExpand">
    <telerik:TreeViewDescriptor DisplayMemberPath="Name"
                                ItemsSourcePath="Children"
                                TargetType="{x:Type viewModel:CatalogParentItemViewModel}" />
    <telerik:TreeViewDescriptor DisplayMemberPath="Name"
                                TargetType="{x:Type viewModel:CatalogItemViewModel}" />
</telerik:RadTreeView>

In the screenshot, the "Sans nom" item is of type CatalogParentItemViewModel and it does have children.

In the console, I have the following error which may be related:

java.lang.RuntimeException: Font asset not found /data/user/0/com.app.test/cache/telerikfont.ttf
	at android.graphics.Typeface.createFromAsset(Typeface.java:1061)
	at crc6452ffdc5b34af3a0f.NavigationViewFragment.n_onCreateView(Native Method)
	at crc6452ffdc5b34af3a0f.NavigationViewFragment.onCreateView(NavigationViewFragment.java:39)
	at androidx.fragment.app.Fragment.performCreateView(Fragment.java:3119)
	at androidx.fragment.app.FragmentStateManager.createView(FragmentStateManager.java:577)
	at androidx.fragment.app.FragmentStateManager.moveToExpectedState(FragmentStateManager.java:286)
	at androidx.fragment.app.FragmentManager.executeOpsTogether(FragmentManager.java:2214)
	at androidx.fragment.app.FragmentManager.removeRedundantOperationsAndExecute(FragmentManager.java:2115)
	at androidx.fragment.app.FragmentManager.execPendingActions(FragmentManager.java:2052)
	at androidx.fragment.app.FragmentManager$5.run(FragmentManager.java:703)
	at android.os.Handler.handleCallback(Handler.java:959)
	at android.os.Handler.dispatchMessage(Handler.java:100)
	at android.os.Looper.loopOnce(Looper.java:232)
	at android.os.Looper.loop(Looper.java:317)
	at android.app.ActivityThread.main(ActivityThread.java:8705)
	at java.lang.reflect.Method.invoke(Native Method)
	at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:580)
	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:886)

How can I have the default style shown in the examples of the documentation?

Thanks

Julien

1 Answer, 1 is accepted

Sort by
0
Didi
Telerik team
answered on 26 Feb 2025, 02:54 PM

Hi Jonathan,

Thank you for the images and code.

I see similar warning from time to time, but this does not prevent the app from running as expected.

I have used the code provided here: https://docs.telerik.com/devtools/maui/controls/treeview/load-children-on-demand and created a sample app using the Telerik MAUI 10.0.0 and net 9 project. I tested on Android and no issues. Image and project are attached. Download, test on your side and let me know the results.

Next Steps:

Modify the app so it matches the exact behavior, then send the app back to me. Also let me know what is the .NET MAUI version you use. 

Regards,
Didi
Progress Telerik

Enjoyed our products? Share your experience on G2 and receive a $25 Amazon gift card for a limited time!

Tags
TreeView
Asked by
Jonathan
Top achievements
Rank 1
Answers by
Didi
Telerik team
Share this question
or