WPF手动触发MouseUp
自己向写一个自定义 listBox 控件,使它拥有HoverTime事件。代码如下:
[解决办法]
image有mouseleftbuttonup 和down的事件 是一样用的啊
楼主可以试试
而且楼主最好不要用这种系统事件
而是自己写一个事件 事件到了抛出来 然后外面用他就可以了啊
在里面写
public event EventHandler<EventArgs> OnTimeUp;
public CustomImageControl()
: base()
{
timeHover = new DispatcherTimer();
timeHover.Tick += (sender, e) =>
{
// 些处想触发 OnMouseUp 事件,应该怎么写。
if(this.OnTimeUp!=null)
this.OnTimeUp(this,new EventArgs());
System.Windows.MessageBox.Show("Yes");
};
timeHover.Interval = new TimeSpan(0, 0, 0, nHoverTimeSenconds, nHoverTimeMilliseconds);
}
在外面写
image.OnTimeUp+= image_MouseUp; // MouseUp 是在这里写的代码