One of the most time consuming tasks, I find with building LOB apps, is setting up columns on Datagrid. You know the game run your application see that column one is truncating the text in a database column. Widen the column and run again, repeat until very bored.
A while back I took the step to programmatically adding a grid style to each class we build (using Anglia's meta build tool Datamaker). This saves so much time as most of the display widths are always pretty close to perfect. One of my colleagues and friends Michael Holland has further refined this process to counter for different DPI screens (cool). Here's an example of what we produce automatically.
public static DataGridTableStyle GridStyle { get { DataGridTableStyle gridstyle = new DataGridTableStyle(); gridstyle.MappingName = "Output[]"; DataGridColumnStyle tempcol = null; // Maps To Database Field - [100] tempcol = new DataGridTextBoxColumn(); tempcol.MappingName = "Onezerozero_Label"; tempcol.HeaderText = "100"; tempcol.Width = 60; tempcol.NullText = "N/A"; gridstyle.GridColumnStyles.Add(tempcol); // Maps To Database Field - [1000] tempcol = new DataGridTextBoxColumn(); tempcol.MappingName = "Onezerozerozero_Label"; tempcol.HeaderText = "1000"; tempcol.Width = 60; tempcol.NullText = "N/A"; gridstyle.GridColumnStyles.Add(tempcol); return (SqlParameter[])returnparams.ToArray(typeof(SqlParameter)); }
}
This saves, Soooo much time particularly when having to deploy to the device emulator. If we need to omit certain columns or swap the order around, its just a cut and paste job.
Theme design by Jelle Druyts
Pick a theme: BlogXP calmBlue
My Virtual Earth Balloon Races www.racingballoon.com Richard JonesPowered By The Fridge Server