First add a canvas:

 Set width and height to auto:

Add a button.

Now comes a tricky part, at least for me, since I don't know how to delete margins from Visual Studio GUI, so I had to do it manually from XAML. So, here is my XAML: 

<Window x:Class="DragNdrop.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        Title="MainWindow" Height="350" Width="525">
    <Grid>
        <Canvas Margin="20" HorizontalAlignment="Left" VerticalAlignment="Top">
            <Button Content="Button" 
                    PreviewMouseLeftButtonDown="Button_PreviewMouseLeftButtonDown" 
                    PreviewMouseLeftButtonUp="Button_PreviewMouseLeftButtonUp" 
                    PreviewMouseMove="Button_PreviewMouseMove"/>
        </Canvas>
    </Grid>
</Window>

Notice that margins from button node are deleted, and margin is equal 20 on canvas (Margin="20"), otherwise button will be away from mouse pointer.

Code looks like this: 

public partial class MainWindow : Window
{
	private double FirstXPos;
	private double FirstYPos;
	private double FirstArrowXPos;
	private double FirstArrowYPos;
	private object MovingObject;
	public MainWindow()
	{
		InitializeComponent();
	}

	private void Button_PreviewMouseLeftButtonDown(object sender, MouseButtonEventArgs e)
	{
		FirstXPos = e.GetPosition(sender as Control).X;
		FirstYPos = e.GetPosition(sender as Control).Y;
		FirstArrowXPos = e.GetPosition((sender as Control).Parent as Control).X - FirstXPos - 20;
		FirstArrowYPos = e.GetPosition((sender as Control).Parent as Control).Y - FirstYPos - 20;
		MovingObject = sender;
	}

	private void Button_PreviewMouseLeftButtonUp(object sender, MouseButtonEventArgs e)
	{
		MovingObject = null;
	}

	private void Button_PreviewMouseMove(object sender, MouseEventArgs e)
	{
		if (e.LeftButton == MouseButtonState.Pressed && sender == MovingObject)
		{
			(sender as Control).SetValue(Canvas.LeftProperty,
				 e.GetPosition((sender as Control).Parent as Control).X - FirstXPos - 20);

			(sender as Control).SetValue(Canvas.TopProperty,
				 e.GetPosition((sender as Control).Parent as Control).Y - FirstYPos - 20);
		}
	}
}

Code you can download from here, dirty as usual and made in VS 2013

<Grid>
	<TextBox Height="194" HorizontalAlignment="Stretch" Name="textBox1" VerticalAlignment="Bottom" TextWrapping="Wrap" AcceptsReturn="True" />
</Grid>

Most important values are: 

TextWrapping="Wrap"

and

AcceptsReturn="True"

Or in properties:

and

If varible is string, then to check if it is null use:

if (containerid.IsNullOrEmpty())
{  containerid = "-1"; }

Or String.IsNullOrEmpty()

Because null is not empty...

Start new Windows Forms Application, for example, name it MyInheritance.

In solution explorer right clink on MyInheritance, like on picture:

Then, in project properties under Output type choose Console Application like on picture:

Save it. Put a button on a form (add form if it doesn't exist), build project.

 

Then, to test it, go to the File -> Add -> New project... Then choose Windows Forms Application, in the solution explorer right click on References, go to the project tab and choose MyInheritance, then right click on this new project -> Add -> New item ->Windows Forms -> Inherited Form -> Ok and this is it.

 

If you want to change a component in your inhertited form, then choose property Modifiers from MyInheritance and change it to Public.

 

Taken from here.