Wednesday, October 31, 2012

silverlight build a datagrid in the code behind

silverlight build a datagrid in the code behind

Is it possible in a Silverlight DataGrid to have a column that has rows with different types of controls? For instance the first two rows of the column should be text, the next two rows would have buttons and then the next 6 rows would have Checkboxes. I need to build it in the code behind also. Any help would be appreciated.

Answers & Comments...

Answer: 1

Maybe the code below code gives you the idea.

        foreach (var item in ItemList)         {             //Row definition and column definitions are similar             LayoutRoot.RowDefinitions.Add(new RowDefinition()              { Height = GridLength.Auto});                       HelloObject hl=new HelloPObject();              //Attached property imeplemantation             Grid.SetRow(hl,Layout2.RowDefinitions.Count);              //You may add any UIElement as Children             LayoutRoot.Children.Add(hl);                         } 
by : Davut Gürbüzhttp://stackoverflow.com/users/413032




No comments:

Post a Comment

Send us your comment related to the topic mentioned on the blog