I'm currently working on building a crossplatform application using xamarin forms. So I started with building a Class Library and added the RadDataGrid and the output can either be a Android or UWP or WPF.
I can get the sample data to be displayed in Android but i get an below issue(attached)
3 Answers, 1 is accepted
Hello Sarada,
The reason for your problems is that we do not support WPF in Xamarin.Forms. At this time, we do not have plans to add WPF to UI for Xamarin because we already have a very large and robust UI suite for WPF, see Telerik UI for WPF.
You can still upvote the Add WPF Feature Request to show your support and increase the interest level.
Here is my recommended structure if you want to add a WPF head:
- A .NET Standard 2.0 class library to hold all the common business logic
- Xamarin.Forms for the Android, iOS and UWP UI layer (using Telerik UI for Xamarin)
- A separate .NET Core 3.0 WPF project for the WPF UI layer (using Telerik UI for WPF).
Demo
I've gone ahead and written a demo for the concept idea, find it attached.
In the solution will see a
- SaradaDataGrid.Common - All sharable code and business logic goes here
- SaradaDataGrid.Wpf - A WPF project (references the Common project)
- SaradaDataGrid.Portable - this is the Xamarin.Forms project (references the Common project)
- SaradaDataGrid.Android - An Xamarin.Android project (references the Xamarin.Forms project)
- SaradaDataGrid.iOS - A Xamarin.iOS project (references the Xamarin.Forms project)
- SaradaDataGrid.UWP - A Windows 10 UWP project (references the Xamarin.Forms project)
A screenshot may help better explain:
Now you can use the same data models, service classes and view models with any of the projects.
Important Note: The WPF project is referencing Telerik UI for WPF packages. If you do not already have UI for WPF, please start a new trial here. After you install UI for WPF, the WPF project's NuGet packages will be able to be restored (see nuget.config).
Runtime Screenshots
WPF project's MainWindow.xaml
Xamarin.Forms project's MainPage.xaml
WPF runtime:
Android runtime:
Further Assistance
If you have any further trouble, please open a new Support Ticket here. You have full Technical Support during your trial, which lets you talk directly to the relevant engineering team.
I hope my reply answers your question and I've provided you with a direction to move forward for all the platforms.
Regards,
Lance | Team Lead - US DevTools Support
Progress Telerik
Our thoughts here at Progress are with those affected by the outbreak.
Hi Vinay,
Indeed, this is a known issue related to Unicode characters and the reason behind is the Skia library we're using for rendering the DataGrid. You can learn more about it in the following feedback item:
DataGrid: [Android][UWP] Some languages are not properly rendered by SkiaSharp elements
Workaround:
As you want to display Japanese characters inside the header, you will need to define HeaderContentTemplate for each column. For example:
<telerikDataGrid:RadDataGrid x:Name="grid"
ItemsSource="{Binding Clubs}"
AutoGenerateColumns="False"
UserEditMode="Cell">
<telerikDataGrid:RadDataGrid.Columns>
<telerikDataGrid:DataGridTextColumn PropertyName="Name" >
<telerikDataGrid:DataGridTextColumn.HeaderContentTemplate>
<DataTemplate>
<Label Text=" おはよう"/>
</DataTemplate>
</telerikDataGrid:DataGridTextColumn.HeaderContentTemplate>
<telerikDataGrid:DataGridTextColumn.CellContentStyle>
<telerikDataGrid:DataGridTextCellStyle TextColor="Green"
FontSize="15"
SelectedTextColor="Orange" />
</telerikDataGrid:DataGridTextColumn.CellContentStyle>
</telerikDataGrid:DataGridTextColumn>
The same approach has to be used for displaying text inside the columns using the CellContentTemplate property.
The feedback item contains a workaround for the issue, also you can check the following how-to article for more details: https://docs.telerik.com/devtools/xamarin/knowledge-base/datagrid-languages-not-rendered-properly-skia
Regards,
Didi
Progress Telerik
Five days of Blazor, Angular, React, and Xamarin experts live-coding on twitch.tv/CodeItLive, special prizes, and more, for FREE?! Register now for DevReach 2.0(20).