Hi.I get this error when RadDataGrid.ItemSource have 100 or more objects.
On Samsung Galaxy S6 edge = Java.Lang.OutOfMemoryError: Failed to allocate a 463014412 byte allocation with 10286048 free bytes and 241MB until OOM
On Pixel 2 XL -> error [ERROR] FATAL UNHANDLED EXCEPTION: Java.Lang.RuntimeException: Canvas: trying to draw too large(346442880bytes) bitmap.
This is the code that triggers this error.
Brand new project(.NET)
using System.Collections.Generic;
using Telerik.XamarinForms.DataGrid;
using Xamarin.Forms;
namespace test
{
public partial class MainPage : ContentPage
{
public MainPage()
{
InitializeComponent();
RadDataGrid gridView = new RadDataGrid();
var data = new List<object>();
for (int i = 0; i < 100; i++)
{
data.Add(new ViewModelData()
{
Data1 = "Data " + i,
Data2 = "Data " + i,
Data3 = "Data " + i,
Data4 = "Data " + i,
Data5 = "Data " + i,
Data6 = "Data " + i,
Data7 = "Data " + i,
Data8 = "Data " + i,
Data9 = "Data " + i,
Data10 = "Data " + i,
Data11 = "Data " + i,
Data12 = "Data " + i,
Data13 = "Data " + i,
Data14 = "Data " + i,
Data15 = "Data " + i,
});
}
gridView.ItemsSource = data;
//container is stacklayout and none of his properties are set.
container.Children.Add(gridView);
}
}
public class ViewModelData
{
public string Data1 { get; set; }
public string Data2 { get; set; }
public string Data3 { get; set; }
public string Data4 { get; set; }
public string Data5 { get; set; }
public string Data6 { get; set; }
public string Data7 { get; set; }
public string Data8 { get; set; }
public string Data9 { get; set; }
public string Data10 { get; set; }
public string Data11 { get; set; }
public string Data12 { get; set; }
public string Data13 { get; set; }
public string Data14 { get; set; }
public string Data15 { get; set; }
}
}
//Xaml Code
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:local="clr-namespace:test"
x:Class="test.MainPage">
<StackLayout x:Name="container">
</StackLayout>
</ContentPage>