Hello there.
i am trying in xamarin c# to do the following scenario :
want to pass a List<NSObject> with string values to a Datasource (this works ok)
but i want to put the column definitions without having any property to export
example :
List<NSObject> foo = new List<NSObject>();
foo.Add(new NSString("a"));
foo.Add(new NSString("b"));
foo.Add(new NSString("c"));
IGGridViewDataSourceHelper datasource = new IGGridViewDataSourceHelper();
IGGridViewColumnDefinition colSubject = new IGGridViewColumnDefinition(); //(Without having any public property) colSubject.HeaderText = @"issue"; datasource.ColumnDefinitions.Add(colSubject);
datasource.Data = foo.ToArray(); _gridView.WeakDataSource = datasource;
_gridView.ReloadData();
this crash because in column definition don't have any property;
But i want to pass a array of values and the columns by hand without having any NSOBject Class that exports some properties.
Is this possible with any way?
Hi Peter
Yes you can do that!
Just use the IGGridViewValueColumnDefinition instead. Note, you still have to pass a key, but it can be anything.
Hope this helps!
-SteveZ
Yes this works, does this support multiple columns?
i mean if i want to make a dynamic screen with grid view that return from one system a list of strings that are one row with multiple columns can i have IGGridViewValueColumnDefinition with more that one column? Because i saw that if i put a second IGGridViewValueColumnDefinition then the values repeat itself in the second column.
The thing is that if you want to make a dynamic screen with one grid view that accepts parameters in controller to manage your screen you can't if i need to make anytime a wrapper class of NSObject type and export public properties. So i try to make a solution in my project about this.
any ideas?
Hi Peter,
if im understanding you correctly, it sounds like you'd want to use the IGGridViewSingleFieldSingleRowDataSourceHelper, instead of the standard DSH.
This DSH takes a column in the constructor and displays the values in the column as a single row over multiple columns instead of a single column over multiple rows.
hello Stephen,
thanks for the response.
the thing that i try is to have many row with many columns (n:n) but to give the values or row and columns manually.
i try to have the above datasource as the example:
NSObject[] data = new NSObject[] { new NSString("a"), new NSString("b")}; IGGridViewValueColumnDefinition colA = new IGGridViewValueColumnDefinition("dataArray"); colA.HeaderText = "Columns A"; IGGridViewSingleRowSingleFieldDataSourceHelper dataSource = new IGGridViewSingleRowSingleFieldDataSourceHelper(colA); // dataSource.ColumnDefinitions.Add(colb); dataSource.Data = data;
but now i have the grid with one row with values "a" and "b" but nothing as header columns.
Also if i want to have two or more rows?
ok then if you want to display calculated values in the other columns, you have two options
1. Create a custom NSObject the has properties that you want to display
2. Create a custom column. Basically derive from iggridviewvaluecolumndefiniton And override the createcell method. You can then put whatever value you want in there.
about the first way all the concept was not to pre code NSObject but make rows with multiple columns in runtime without having NSObject properties with export decoration
about the second way i will give a try but isn't so flexible.. so ins't much that i can do.
anyway thank you for your time and response.