WPF 快速制作可拖拽的对象和窗体

引用类库:

1、Microsoft.Expression.Interactions

2、System.Windows.Interactivity

<Window x:Class="WpfApplication4.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity"
        xmlns:b="http://schemas.microsoft.com/expression/2010/interactions"
        Title="MainWindow" Height="350" Width="525">
    <Grid Background="Gray">
        <i:Interaction.Behaviors>
            <b:MouseDragElementBehavior/>
        </i:Interaction.Behaviors>
        <Grid.RowDefinitions>
            <RowDefinition Height="auto"></RowDefinition>
        </Grid.RowDefinitions>
        <StackPanel Orientation="Horizontal">
            <Button Width="100" Height="23" Content="Stop" Click="Button_Click"/>
        </StackPanel>
    </Grid>
</Window>
原文地址:https://www.cnblogs.com/tianciliangen/p/4959796.html