954,510 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

How do you span columns in C#?

How do you span columns in C#?
In silverlight, suppose you have a grid, and this grid is in 3 columns.
and you want to add a UserControl to this grid but you want it to span all three
columns. How would that C# code look like?
Grid1.Children.Add(UserControl01);
But then what?
Grid1.Children.ElementAt(1).SetValue(Grid.SetRowSpan, 2); ??

complete
Junior Poster
153 posts since Dec 2005
Reputation Points: 17
Solved Threads: 0
 


Grid.SetColumnSpan.

In Vb but you should get the point.

Dim SpannedButton As New System.Windows.Controls.Button
   SpannedButton.HorizontalAlignment = Windows.HorizontalAlignment.Stretch
   SpannedButton.Content = "Spanned Three"

   Windows.Controls.Grid.SetColumn(SpannedButton, 0)
   Windows.Controls.Grid.SetRow(SpannedButton, 0)
   Windows.Controls.Grid.SetColumnSpan(SpannedButton, 3)

   Grid1.Children.Add(SpannedButton)
Unhnd_Exception
Posting Pro
570 posts since Nov 2010
Reputation Points: 249
Solved Threads: 201
 
How do you span columns in C#? In silverlight, suppose you have a grid, and this grid is in 3 columns. and you want to add a UserControl to this grid but you want it to span all three columns. How would that C# code look like? Grid1.Children.Add(UserControl01); But then what? Grid1.Children.ElementAt(1).SetValue(Grid.SetRowSpan, 2); ??

Grid1.Children.Add(UserControl01);

Grid.SetColumnSpan(UserControl01, 3);

complete
Junior Poster
153 posts since Dec 2005
Reputation Points: 17
Solved Threads: 0
 


Whats that suppose to mean.

Did it not work? Or where you wanting it in c# not vb. The only difference is a ; in this case.

Unhnd_Exception
Posting Pro
570 posts since Nov 2010
Reputation Points: 249
Solved Threads: 201
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You