Page 1 of 1

Problems using DataGrid with T4A

Posted: Mon Apr 21, 2014 12:42 pm
by pmanuel
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)
ok.png
ok.png (32.15 KiB) Viewed 10800 times
When running in the target, with exactly the same (just for example) code, the Datagrid apears empty as bellow (screenshot)
scrnHistorico 21-04-2014 20.34.22.png
scrnHistorico 21-04-2014 20.34.22.png (5.1 KiB) Viewed 10800 times
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.

Re: Problems using DataGrid with T4A

Posted: Tue Apr 22, 2014 2:52 pm
by stuartm
Looks like you need to manually create the datarow. It is possible iterate over an IEnumerable<T> implementation insert every row.

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;
Best Regards,
Stuart

Re: Problems using DataGrid with T4A

Posted: Wed Apr 23, 2014 3:03 am
by pmanuel
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.

Re: Problems using DataGrid with T4A

Posted: Wed Apr 23, 2014 7:06 am
by Edmund
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.

Re: Problems using DataGrid with T4A

Posted: Thu Apr 24, 2014 6:01 am
by pmanuel
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

Re: Problems using DataGrid with T4A

Posted: Thu Apr 24, 2014 10:34 am
by stuartm
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.

Re: Problems using DataGrid with T4A

Posted: Thu Apr 24, 2014 10:37 am
by Edmund
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.