尝试根据以下代码包含hoverIntent:
private void ViewerTab_MouseLeave(object sender, MouseEventArgs e)
{
_mouseOverTabPanel = false;
ChangeCurrentPanelPosition(TabPanelPosition.Bottom);
}
private void ViewerTab_MouseEnter(object sender, MouseEventArgs e)
{
_mouseOverTabPanel = true;
}
理想情况下,ChangeCurrentPanelPosition只应在mouseleave约1秒后触发,如果mouseEnter再次显示,则计时器将清除。
答案 0 :(得分:0)
这对我有用:
public DispatcherTimer myDispatcherTimer = new DispatcherTimer();
private void ViewerTab_MouseLeave(object sender, MouseEventArgs e)
{
myDispatcherTimer.Interval = new TimeSpan(0, 0, 0, 0, 1000);
myDispatcherTimer.Tick += new EventHandler(functiontocall);
myDispatcherTimer.Start();
}
public void functiontocall(object o, EventArgs sender)
{
// do something here
myDispatcherTimer.Stop();
}
private void ViewerTab_MouseEnter(object sender, MouseEventArgs e)
{
myDispatcherTimer.Stop();
}