Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FlexGrid ios binding to a dataview problem #8

Open
enkaradag opened this issue Jan 31, 2024 · 2 comments
Open

FlexGrid ios binding to a dataview problem #8

enkaradag opened this issue Jan 31, 2024 · 2 comments

Comments

@enkaradag
Copy link

enkaradag commented Jan 31, 2024

Hi

Below code (simply binding a DataView to a FlexGrid) shows all rows but all are empty for iOS. I tested flexgrid lots of times for ios, it was working with ItemSource = DataView before.

For winui and android, same code works, rows are drawn correctly

FlexGrid grid=new FlexGrid(){HeightRequest=500, grid.AutoGenerateColumns = false};
...
DataTable DT=new DataTable();
DT.Columns.Add("FIELD1",typeof(string));
DT.Columns.Add("FIELD2",typeof(string));

DT.Rows.Add("FIELD1_DATA1","FIELD2_DATA1");
DT.Rows.Add("FIELD1_DATA2","FIELD2_DATA2");

grid.Columns.Add(new GridColumn() {Binding="[FIELD1]",Width=100,ColumnName="FIELD1"};
grid.Columns.Add(new GridColumn() {Binding="[FIELD2]",Width=100,ColumnName="FIELD2"};
grid.ItemsSource=DT.DefaultView;

Edit : Bindings are in [ ]. It's still not working for ios

Am i missing something for IOS?

Regards

Ender

@arivoir
Copy link
Contributor

arivoir commented Jan 31, 2024

Hi @enkaradag , I'm not sure what is the issue you're seeing (I'm having trouble to connect with mac right now), but to bind a DataTable to FlexGrid in Maui it's better to use the adapter so every feature like sorting, filtering, editing is performed as expected.

grid.ItemsSource = new C1BindingListDataCollection(DT.DefaultView);

You'll need to add the package

<PackageReference Include="C1.DataCollection.BindingList" Version="8.0.20233.180" />

@arivoir
Copy link
Contributor

arivoir commented Feb 1, 2024

Hi @enkaradag , I recover my mac and could connect to it, I see when I use C1BindingListDataCollection everything works as expected, even the column's auto-generation, so you don't need to create the columns manually.

DataTable DT = new DataTable();
DT.Columns.Add("FIELD1", typeof(string));
DT.Columns.Add("FIELD2", typeof(string));

DT.Rows.Add("FIELD1_DATA1", "FIELD2_DATA1");
DT.Rows.Add("FIELD1_DATA2", "FIELD2_DATA2");

grid.ItemsSource = new C1BindingListDataCollection(DT.DefaultView);
image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants