2
votes

I am trying to explore behaviors with expression blend. I have seen the mouse drag used online in various tutorials however I can't get it to work. Here is the example code - this is the whole thing...

<Window
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity" xmlns:ei="http://schemas.microsoft.com/expression/2010/interactions" mc:Ignorable="d"
x:Class="VsmTest.MainWindow"
x:Name="Window"
Title="MainWindow"
Width="640" Height="480">

<Grid x:Name="LayoutRoot">
    <Button Content="Button" Height="25" Width="100">
        <i:Interaction.Behaviors>
            <ei:MouseDragElementBehavior/>
        </i:Interaction.Behaviors>
    </Button>

</Grid>

As far as I know I should be able to drag that button around now but it doesn't work - hmm... Is there something I am missing? Most of the tutorials I have seen use blend 3 so it looks a little different so maybe I am missing thing there.

Thanks!

1

1 Answers

4
votes

The Button intercepts the Behavior logic since it handles clicks, if you replace the Button with something else like a Rectangle it should work.