Silverlight xap not updating
A useful trick here is to use the C# and VB 3.0 Object Initializer feature to initialize the Data objects as we add them to the List.
C# When you run this you will notice that columns are created for you.
If you have ever worked on an application that displayed large amounts of data, one of the cornerstones of your application was probably a Data Grid control. At MIX 2008 we shipped the first preview of the Silverlight Data Grid and a preview of it in WPF was also shown.
Now that it is out there people want to know how to use it.
(If you did not want this behavior, but rather wanted to choose your own columns, you can do this by setting the Data Grid's Auto Generate Columns property to false.
For information on choosing your own columns see my post on Defining Columns for a Silverlight Data Grid) The easiest way to customize the Data Grid is through a variety of properties.
Now just find the Data Grid on the Toolbox and drag it into the root layout Grid named "Layout Root".
This does a few things behind the scenes: If you are the type of the person who likes to see things working after each step, feel free to F5 (choose the option to allow debugging in the popup) and take in the awesome sight that is an empty Data Grid. The way to make a Data Grid interesting is by giving it some data.
Some of the most useful properties for customization are: Grid Lines Visibility & Headers Visibility These properties are enumerations that control what gridlines and headers are displayed.
Row Background & Alternating Row Background These properties are shortcuts to setting the background color for both rows and alternating rows.
Column Width & Row Height These properties set the default column width and default row height.
Lets add some more complicated data so that we actually need to use a Data Grid.
Add a new class to your Silverlight project (not the Web project) and name it "Data". C# If you are using C#, you can use the great 3.0 Automatic Properties feature.
Is Read Only & Can User Resize Columns These properties control if the end user can edit the data in the grid and if the columns can be resized.