How to show tabular data?

Oct 25, 2010 at 12:09 PM

Thanks for the great work. But I want to know how to show tabular data under Silvermoon? I sdutied the Grid example, but I havenot find proper way to do this. The code I used are like following:

void ShowDatatable( DataTable dt )



            Grid.Columns.AddRange( GridUnit.Auto, dt.Columns.Count );

            Grid.Rows.AddRange( GridUnit.Auto, dt.Rows.Count );

           for( int rowIndex = 0; rowIndex < dt.Rows.Count; rowIndex++ )


                   for( int colIndex = 0; colIndex < dt.Columns.Count; colIndex++ )


                          Label = new Label{ .... }

                         Grid.SetControl( colIndex, rowIndex, dt.Rows[colIndex].ToString() );



Can you give me a real and property example ? Thanks a lot.


Oct 25, 2010 at 12:49 PM

I would use a ListView.

Plenty of working examples for that.

Oct 25, 2010 at 7:26 PM

a grid is used to layout other controls in a static way. it's not meant to be used for dynamic data. for that purpose there is the ListView+ListViewController pair which also virtualizes the required controls. imagine a data source with 20000 entries. in a grid you'd really need 20000 controls for the sake of only showing 8 at one time. ListView+ListViewController reuses the visible controls of 8 ListViewItems for the complete data.

Showing columns in a ListView is not supported. It simply makes no sense to have columns on a small device and introducing a horizontal scrollbar would make the usage very cumbersome. You need to design a listview item which shows all necassary "columns". Maybe you even use a grid to layout the columns (not only in one, but rather in multiple lines). Just take a look at the WP7 email and how it is layouted.

you'll find many examples in the demos.