- c - 在位数组中找到第一个零
- linux - Unix 显示有关匹配两种模式之一的文件的信息
- 正则表达式替换多个文件
- linux - 隐藏来自 xtrace 的命令
我正在开发 Windows Phone 8 XAML 应用程序。
我为 XAML 页面中的多个对象定义了 MouseEnter 事件。 (例如两个矩形)。触发这些对象的 MouseEnter 事件后,我按下同一页面上的一个按钮。按钮按下不仅会触发其自身的点击事件。它还会触发最后输入的 Rectangle 的 MouseEnter 事件。
这个问题可以通过一个只有两个矩形和一个按钮的新项目重现。这种行为并不总是出现,但可以在几次触发 Rectangles 的 MouseEnter 事件后观察到。
我的 XAML 对象如下。
<Rectangle Fill="#FFF4F4F5" HorizontalAlignment="Left" Height="100"
Margin="102,306,0,0" Stroke="Black"
VerticalAlignment="Top" Width="100"
MouseEnter="Rectangle_MouseEnter"/>
<Rectangle Fill="#FFF4F4F5" HorizontalAlignment="Left" Height="100"
Margin="314,306,0,0" Stroke="Black"
VerticalAlignment="Top" Width="100"
MouseEnter="Rectangle_MouseEnter"/>
<Button Content="Button" HorizontalAlignment="Left"
Margin="256,481,0,0" VerticalAlignment="Top" Click="Button_Click"/>
后面的代码看起来像这样。
private void Rectangle_MouseEnter(object sender,
System.Windows.Input.MouseEventArgs e)
{
Debug.WriteLine("Rectangle_MouseEnter");
}
private void Button_Click(object sender, RoutedEventArgs e)
{
Debug.WriteLine("Button_Click");
}
最佳答案
如果我记得,在 Windows pone 和 Windows 8 应用程序中,最好使用点击事件而不是鼠标事件。这可能是问题所在。查看此链接:
http://msdn.microsoft.com/en-us/library/windows/apps/windows.ui.xaml.uielement.tapped.aspx
关于c# - MouseEnter 事件的奇怪行为,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18836189/
我试图在鼠标输入鼠标离开事件时替换图像属性源。单击时,图像应保持事件状态。我需要 mouseleave 事件在单击后停止。到目前为止,点击后鼠标离开仍然继续,切换回图像,代码如下: jQue
我经常看到这样的代码: $("#thing").on("mouseenter",function(){ Do stuff }); 就个人而言,我几乎总是这样写: $("#thing").mouseen
我用 mouseenter 和 mouseleave 制作了一些积木 hover MouseEnter(e) { setTimeout(() => { //check if m
使用菜单目标: https://github.com/hfknight/jQuery-menu-aim/blob/master/jquery.menu-aim.js 在响应方面遇到问题。它使用 mou
我有一个盒子,悬停时会播放加载动画,然后在 2 秒后展开: http://jsfiddle.net/frank_o/WwD5V/23/embedded/result/ 但是如果我按照下面的 V 形 A
我是 Jquery 和 JS 的新手,所以希望有人能够提供帮助!我已经构建了我的第一个图像 slider ,除了手持设备之外,它都运行良好。基本上,当宽度降至某个点以下时,幻灯片会重叠,但是当我将鼠标
我正在编写一个函数,当鼠标进入 DOM 的特定部分以显示菜单时,删除包含内容 display:hidden; 的类。现在,当页面加载并且我最初将鼠标悬停在该区域上时,该事件不会触发。但是,如果我将鼠标
我有一组 3 个菜单项,我正在尝试向其中添加 mouseenter 事件。我似乎根本无法让它发挥作用。我还尝试循环遍历 .menu-item 类,但没有任何反应。 这让我发疯。有谁知道为什么这不起作用
我正在创建一个自定义光标“预告片”(请参阅 fiddle :https://jsfiddle.net/alexdlf/hx6yzu4w/) 通常,圆圈 (.cursor) 应跟随光标。将鼠标悬停在
我有两个对话气泡每两秒更改一次内容。我试图每次将鼠标放在气泡上时,我的changeComment函数都会停止,这样用户将有更多时间阅读评论,当鼠标离开气泡时,函数将再次启动。 我在这里有我的演示:ht
我编写了一段代码,当鼠标悬停在特定元素上时,我需要触发功能。 对于以下所有静态代码,其工作正常 $("table td").on("mouseenter",function(){ consol
我有一个由 5 个 JLabel 对象组成的数组,并且我已向所有对象添加了鼠标监听器,在 mouseEntered() 函数中,我将标签设为不透明(true)更改其背景颜色,但此代码无法正常工作,请帮
我正在尝试进行 mouseEntered 测试来更改方形颜色,但是 MouseListener mouseEntered 不会执行。鼠标有响应,但仅对单击、按下和释放有响应。所以我不确定发生了什么事。
我在尝试制作一个更改其图标的突出显示“标签”时遇到问题,好吧,所以当为一个 jLabel 调用 MouseEntered 事件时,附近的每个标签的事件也会被调用,并且它们的图标也会被更改。我尝试通过使
我必须调用一个由特定元素上的 mouseenter 事件触发的函数。 如何仅当鼠标在特定元素上“停留”超过 5 秒时才触发 mouseenter 事件? 最佳答案 你可以使用定时器(setTimeou
我有两个可排序列表,一个是嵌套的,鼠标输入对嵌套可排序列表的 li 元素有效果。我的问题是,当用户在作为输入字段的子元素上的列表中快速移动鼠标时,mouseenter 和 mouseleave 函数的
我有一些小div,单击它们时,会显示一个更大的div,覆盖所有内容 - 有点像灯箱。为了隐藏大 div,我单击它(没有“关闭此”链接)。 这是点击代码: // First click - draw i
我有一个网站,当您将鼠标悬停在图像上时,图像上会显示一段文本。 达到了预期的效果,除了以下事实:如果您的光标位于图像上的新文本元素上,则所有内容都会开始闪烁。 任何帮助将不胜感激。 这是 fiddle
当元素上触发 mouseenter 事件时,我使用此指令执行某些操作。但是,当我快速拖动鼠标时,在元素上某些元素会被跳过,而不会触发 mouseenter 事件。 我实际上想在鼠标移动时突出显示网格的
基本上,我有一个包含大约 12 个列表项的无序列表。我想在鼠标悬停在其中任何一个上时对它们应用一种样式,而在鼠标不在任何一个上时应用不同的样式。 例如,以下是我当前的代码,它只有在悬停 li 时才具有
我是一名优秀的程序员,十分优秀!