当我将鼠标移到ListView对象上时,我想显示一种窗口。当鼠标离开对象时,窗口应该再次关闭。
有人给我一些提示吗?
当然,这不是这样的。此外,窗口应该去鼠标,而不是某处。
测试:
private void ListViewBilling_MouseEnter(object sender, MouseEventArgs e)
{
_billingInfoWindow = new BillingInfoWindow();
_billingInfoWindow.ShowDialog();
}
private void ListViewBilling_MouseLeave(object sender, MouseEventArgs e)
{
_billingInfoWindow.Close();
}窗口不断地关闭和打开。
当鼠标移动到ListView对象上时,如何才能显示窗口(弹出)?并不是在ListView的所有地方。
发布于 2019-07-24 13:50:05
您应该使用ToolTip或弹出控件。详情如下:
理解不同之处,选择你所需要的最好的。主要的区别是:
弹出窗口也可以在悬停时打开。
发布于 2019-07-24 13:51:06
所发生的情况是打开对话框,这将导致鼠标离开计费窗口,从而导致对话框关闭。然后,鼠标重新进入计费窗口,打开对话框等。这将导致您所看到的循环。
我建议您在鼠标离开对话框时调整并关闭对话框。
发布于 2019-07-26 09:00:40
我目前的解决方案如下所示:
private void Show_PopupBillingPreview(object sender, MouseEventArgs e)
{
var listViewItem = e.Source as ListViewItem;
var billing = listViewItem?.Content as Billing;
PuBillingPreviewTitle.Text = billing?.BillingId.ToString();
PuBillingPreview.PlacementTarget = listViewItem;
PuBillingPreview.Placement = PlacementMode.MousePoint;
PuBillingPreview.IsOpen = true;
}
private void Hide_PopupBillingPreview(object sender, MouseEventArgs e)
{
if (PuBillingPreview.IsOpen)
PuBillingPreview.IsOpen = false;
}现在我有一个问题,当弹出窗口直接出现在鼠标下面时,我会闪烁。
https://stackoverflow.com/questions/57183950
复制相似问题