【问题标题】:MouseDragElementbehavior for wpf app using expression blend使用表达式混合的 wpf 应用程序的 MouseDragElementbehavior
【发布时间】:2011-05-17 14:18:06
【问题描述】:

我正在尝试通过表情混合来探索行为。我已经在各种教程中看到了在线使用的鼠标拖动,但是我无法让它工作。这是示例代码 - 这就是全部内容......

<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>

据我所知,我现在应该可以拖动那个按钮,但它不起作用 - 嗯......我有什么遗漏吗?我见过的大多数教程都使用 blend 3,所以它看起来有点不同,所以也许我在那里遗漏了一些东西。

谢谢!

【问题讨论】:

    标签: wpf expression-blend


    【解决方案1】:

    Button 会拦截 Behavior 逻辑,因为它处理点击,如果您将 Button 替换为 Rectangle 之类的其他内容,它应该可以工作。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-04-10
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-07-17
      • 1970-01-01
      相关资源
      最近更新 更多