0

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); ??

2
Contributors
3
Replies
4
Views
6 Years
Discussion Span
Last Post by Unhnd_Exception
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)
-1

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);

Votes + Comments
Unhnd_Exception
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.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.