Reputation: 6132
I am trying to add multiple items in to a grid, so that later items will pop up underneath earlier items.
TextBox foo = new TextBox();
foo.Text = " " + id + " ";
foo.Width = 440;
foo.Height = 200;
foo.VerticalAlignment = "Top";
foo.Background = new SolidColorBrush(Colors.Red);
((Grid)daysPanels[id].Content).Children.Add(foo);
Unfortunately, the VerticalAlignment = "Top"
line isn't working, it says it can't implicitly convert type "String" to type "VerticalAlignment". Am I doing this the right way and how can I fix that error?
Upvotes: 0
Views: 1068
Reputation: 14994
Look at the msdn documentation. VerticalAlignment is an enum.
foo.VerticalAlignment = VerticalAlignment.Top;
Upvotes: 2