Hello to all.
I'm experiencing some problems using datagrid object (Target: T4A; iX version: 2.0).
When in simulation mode, the Datagrid shows filled as in the picture (OK)
When running in the target, with exactly the same (just for example) code, the Datagrid apears empty as bellow (screenshot)
Code used:
void btExport_Click(System.Object sender, System.EventArgs e)
{
/*scptDatabaseTools dbTools=new scptDatabaseTools();
DataSet dsOrig=dbTools.GetResultSet("ResultadosTesteLogger");*/
DataSet ds=new DataSet();
//MessageBox.Show(""+dbTools.GetCSVHeader(ds.Tables[0].Columns));
//MessageBox.Show(""+dbTools.GetCSVRow(ds.Tables[0].Rows[0]));
//Just for debug
DataTable dataTbl = new DataTable("Teste");
dataTbl.Columns.Add("Hello1", System.Type.GetType("System.String"));
dataTbl.Columns.Add("Hello2", System.Type.GetType("System.String"));
ds.Tables.Add(dataTbl);
DataGrid1.DataSource=ds.DefaultViewManager;
//Just for debug
}
Can you please tell me what am I doing wrong?
Thanks in advance.
Problems using DataGrid with T4A
Re: Problems using DataGrid with T4A
Looks like you need to manually create the datarow. It is possible iterate over an IEnumerable<T> implementation insert every row.
Best Regards,
Stuart
Code: Select all
DataSet ds=new DataSet();
DataTable dataTbl = new DataTable("Teste");
dataTbl.Columns.Add("Hello1", typeof(string));
dataTbl.Columns.Add("Hello2", typeof(string));
DataRow row = dataTbl.NewRow();
row["Hello1"] = "World1";
row["Hello2"] = "World2";
dataTbl.Rows.Add(row);
ds.Tables.Add(dataTbl);
DataGrid.DataSource = ds.DefaultViewManager;
Stuart
- Attachments
-
- DataGrid.png (40.72 KiB) Viewed 12741 times
Re: Problems using DataGrid with T4A
Hello Stuart.
I already tested your code. The same symptoms. The problem is not related with the fact that the datagrid has no added rows. I think you understood that the problem was with the null values on rows... The problem is that when I download the project to the physical target (T4A) the datagrid appears empty. Exactly the same code running: in simulation mode datagrid filled; on target: datagrid empty (as in the pictures I sent).
Thanks by your reply.
I already tested your code. The same symptoms. The problem is not related with the fact that the datagrid has no added rows. I think you understood that the problem was with the null values on rows... The problem is that when I download the project to the physical target (T4A) the datagrid appears empty. Exactly the same code running: in simulation mode datagrid filled; on target: datagrid empty (as in the pictures I sent).
Thanks by your reply.
Re: Problems using DataGrid with T4A
Try use a Listview instead (it works in runtime).
Set the columns and bindings in the Xaml and load the data into it via ItemsSource.
Set the columns and bindings in the Xaml and load the data into it via ItemsSource.
Re: Problems using DataGrid with T4A
Hello Edmond.
I tryed to modify the XAML file following the example given by you on post
http://beijerinc.com/support/ix/forum/v ... 66d2#p3736
but i can´t get it to work. Always get a XAML error message and I can´t find more information (probably a XAML syntax error) to try to solve the problem.
My XAML portion of code refering to the ListView:
<nacn:NeoWindowsFormsHost Background="#FFFFFFFF" Name="ListView1" Width="252" Height="182" RenderTransformOrigin="0.5,0.5" Visibility="Visible" Panel.ZIndex="10" Canvas.Left="208" Canvas.Top="34">
<nacn:NeoWindowsFormsHost.Control>
<swf:ListView Text="ListView" Enabled="True" Font="Microsoft Sans Serif, 8.25pt" Location="0, 0" Name="ListView1_ListView" Size="252, 182" TabIndex="0" />
</nacn:NeoWindowsFormsHost.Control>
</nacn:NeoWindowsFormsHost>
Can you give me an example how to do columns and bindings?
Thanks
I tryed to modify the XAML file following the example given by you on post
http://beijerinc.com/support/ix/forum/v ... 66d2#p3736
but i can´t get it to work. Always get a XAML error message and I can´t find more information (probably a XAML syntax error) to try to solve the problem.
My XAML portion of code refering to the ListView:
<nacn:NeoWindowsFormsHost Background="#FFFFFFFF" Name="ListView1" Width="252" Height="182" RenderTransformOrigin="0.5,0.5" Visibility="Visible" Panel.ZIndex="10" Canvas.Left="208" Canvas.Top="34">
<nacn:NeoWindowsFormsHost.Control>
<swf:ListView Text="ListView" Enabled="True" Font="Microsoft Sans Serif, 8.25pt" Location="0, 0" Name="ListView1_ListView" Size="252, 182" TabIndex="0" />
</nacn:NeoWindowsFormsHost.Control>
</nacn:NeoWindowsFormsHost>
Can you give me an example how to do columns and bindings?
Thanks
Re: Problems using DataGrid with T4A
Try this application out. I found a Datagrid example from way back. It was useless for me trying to build an app from MSDN since most the of the Datagrid examples are written not for CE and will not work. I'm sure both can be used however I don't have weeks of free time making old technology new.
The application queries the sql database and creates a GridView. The developer can control what values are displayed programmatically.
The application queries the sql database and creates a GridView. The developer can control what values are displayed programmatically.
- Attachments
-
- SET THIS FIRST!!!.JPG (122.43 KiB) Viewed 12716 times
-
- Script_Database_Adjustable_Columns.zip
- (200.75 KiB) Downloaded 932 times
Re: Problems using DataGrid with T4A
pmanuel wrote:Hello Edmond.
I tryed to modify the XAML file following the example given by you on post
http://beijerinc.com/support/ix/forum/v ... 66d2#p3736
but i can´t get it to work. Always get a XAML error message and I can´t find more information (probably a XAML syntax error) to try to solve the problem.
My XAML portion of code refering to the ListView:
<nacn:NeoWindowsFormsHost Background="#FFFFFFFF" Name="ListView1" Width="252" Height="182" RenderTransformOrigin="0.5,0.5" Visibility="Visible" Panel.ZIndex="10" Canvas.Left="208" Canvas.Top="34">
<nacn:NeoWindowsFormsHost.Control>
<swf:ListView Text="ListView" Enabled="True" Font="Microsoft Sans Serif, 8.25pt" Location="0, 0" Name="ListView1_ListView" Size="252, 182" TabIndex="0" />
</nacn:NeoWindowsFormsHost.Control>
</nacn:NeoWindowsFormsHost>
Can you give me an example how to do columns and bindings?
Thanks
Hi pmanuel!
I´m really sorry, I don´t know what I was thinking about when I posted this... I was thinking your target was a computer (TxC, full framework)... My suggest will not work for you....
Once again, sorry.