Open yordanz opened 1 year ago
I have the same problem
I can't reproduce it currently. Can you share minimal reproduction steps? Or example code to achieve this visual.
I can't reproduce the code, because when I first started using material:DataGrid it was working fine, and then after developing other functions, this problem suddenly appeared. Part of the reason I can find for now is that I placed material:DataGrid.Columns inside a ScrollView container. This problem occurs when the ScrollView sets the Height, and does not occur if the Height property is removed
If someone shares a project that reproduces the problem, I can take an action on this issue. Otherwise, I don't have any guesses on it.
This issue is reproducible in iOS. Android works as expected. It can be easily reproducible with Uranium UI -> Demo project. (https://github.com/enisn/UraniumUI/tree/develop/demo/UraniumApp)
With UraniumUI -> Demo project. Select Menu ->Datagrid-> "Custom data grid" in iOS device.
Simple data grid works well, but when columns are customized it fails.
I am using VS 2022 (Version 17.5.4), it was working in VS 17.5.0
Still investigating, it's a strange behavior on Apple devices
I finally get some errors from native implementation on MacOS. It might be related to MAUI Grid implementation, I'll check and update this issue soon
Mono.Debugging.Evaluation.EvaluatorException: System.NotSupportedException: Specified method is not supported.
at Mono.Debugging.Soft.MethodCall.get_ReturnValue() in D:\a\_work\1\s\external\debugger-libs\Mono.Debugging.Soft\SoftDebuggerAdaptor.cs:line 2890
at Mono.Debugging.Soft.SoftEvaluationContext.RuntimeInvoke(MethodMirror method, Object target, Value[] values, Boolean enableOutArgs, Value[]& outArgs) in D:\a\_work\1\s\external\debugger-libs\Mono.Debugging.Soft\SoftEvaluationContext.cs:line 205
at Mono.Debugging.Soft.SoftEvaluationContext.RuntimeInvoke(MethodMirror method, Object target, Value[] values) in D:\a\_work\1\s\external\debugger-libs\Mono.Debugging.Soft\SoftEvaluationContext.cs:line 132
at Mono.Debugging.Soft.PropertyValueReference.GetValue(EvaluationContext ctx) in D:\a\_work\1\s\external\debugger-libs\Mono.Debugging.Soft\PropertyValueReference.cs:line 131
at Mono.Debugging.Soft.PropertyValueReference.get_Value() in D:\a\_work\1\s\external\debugger-libs\Mono.Debugging.Soft\PropertyValueReference.cs:line 118
at Mono.Debugging.Evaluation.ObjectValueAdaptor.GetObjectValueChildren(EvaluationContext ctx, IObjectSource objectSource, Object type, Object obj, Int32 firstItemIndex, Int32 count, Boolean dereferenceProxy) in D:\a\_work\1\s\external\debugger-libs\Mono.Debugging\Mono.Debugging.Evaluation\ObjectValueAdaptor.cs:line 609
I'll post some of my findings when investigating this issue:
This has been an issue for me because I have multiple sets of data that need to be binded to the DataGrid after the page/window loads. Here is the code:
XAML:
<?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:controls="clr-namespace:UraniumUI.Material.Controls;assembly=UraniumUI.Material"
x:Class="IDX.Toolkit.UI.DatagridBug"
Title="DatagridBug">
<Grid RowDefinitions="*, Auto">
<controls:DataGrid x:Name="dgRecords"
UseAutoColumns="True"/>
<Button x:Name="btnLateLoad"
Clicked="btnLateLoad_Clicked"
Grid.Row="1"
Text="Late Load"/>
</Grid>
</ContentPage>
C#
namespace IDX.Toolkit.UI;
public partial class DatagridBug : ContentPage
{
public DatagridBug()
{
InitializeComponent();
// --- RECORDS POPULATE FINE WHEN LOADED VIA CONSTRUCTOR ---
//var collection = new List<DataGridRecord>();
//collection.Add(new DataGridRecord() { Name = "Test" });
//dgRecords.ItemsSource = collection;
}
void btnLateLoad_Clicked(System.Object sender, System.EventArgs e)
{
var collection = new List<DataGridRecord>();
collection.Add(new DataGridRecord() { Name = "Test" });
dgRecords.ItemsSource = collection;
}
}
public class DataGridRecord
{
public string Name { get; set; }
}
Another note: I found a workaround for someone who wants to bind the data after page/window loads (until there is a bugfix):
Yep... Having the same problem
Another note: I found a workaround for someone who wants to bind the data after page/window loads (until there is a bugfix):
- First, you have to set the ItemsSource property inside the constructor. Most importantly, the collection you are assigning to ItemsSource property needs to have AT LEAST one record (if it is dummy data, then it is up to you to figure out what value to display to the user).
- After that, you can use the buttons to update the existing collection (if it is ObservableCollection and has the NotifyPropertyChanged delegates) or assign a new collection to the ItemsSource.
👆 This workaround works for now.
Unfortunately, I couldn't identify the problem. It happens on the native platform and it's hard to debug native controls created by the handler on the native platform. I'll change DataGrid implementation logic soon, this will be solved probably too
I had this problem. It was caused by having a picker on the page with the datagrid and using a converter on the picker, EnumToIntConverter from the community toolkit I believe. Soon as I got rid of that it started working. Have had loads of problems with converters in maui.
I had this problem. It was caused by having a picker on the page with the datagrid and using a converter on the picker, EnumToIntConverter from the community toolkit I believe. Soon as I got rid of that it started working. Have had loads of problems with converters in maui.
It's a strange case, I'll take a look at this condition, thanks for sharing
I changed a working collection view to a Uranium DataGrid, which looks great on my Windows machine. However, when I deploy to my Android phone (with EMUI 12), I see the attached.