locked
Text Inside a rectangle dynamically in stackpanel RRS feed

  • Question

  • I want to add a rectangle in a StackPanel, then text inside the rectangle. How can it be achieved?

    Monday, October 14, 2013 7:31 PM

Answers

  • Got it, Looks like this is working

    Border rectangleborder = new Border();
                rectangleborder.Background = new SolidColorBrush(Colors.White);
                rectangleborder.BorderBrush = new SolidColorBrush(Colors.Black);
                rectangleborder.BorderThickness = new Thickness(2);
                rectangleborder.Width = 200;
                rectangleborder.Height = 60;
                TextBox textbox = new TextBox();
                textbox.IsReadOnly = true;
                textbox.Text = "Text in a Rectangle";
                meetingScheduleStack.Children.Add(rectangleborder);
                rectangleborder.Child = textbox;


    • Marked as answer by Ningomba Monday, October 14, 2013 7:38 PM
    Monday, October 14, 2013 7:37 PM