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>

 

posted @ 2015-11-12 17:55  天王星天  阅读(668)  评论(0)    收藏  举报