Add TextBox to default docking space : TextBox Style « Windows Presentation Foundation « C# / CSharp Tutorial






using System;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Controls.Primitives;
using System.Windows.Input;
using System.Windows.Media;

public class MeetTheDockers : Window
{
    [STAThread]
    public static void Main()
    {
        Application app = new Application();
        app.Run(new MeetTheDockers());
    }
    public MeetTheDockers()
    {
        DockPanel dock = new DockPanel();
        Content = dock;

        TextBox txtbox = new TextBox();
        txtbox.AcceptsReturn = true;

        dock.Children.Add(txtbox);

        txtbox.Focus();        

    }
}








24.15.TextBox Style
24.15.1.Reuse Style for TextBoxReuse Style for TextBox
24.15.2.Change TextBox background and font size
24.15.3.Set VerticalScrollBarVisibility for TextBox
24.15.4.Change TextBox Margin
24.15.5.Add TextBox to default docking space