//使用一个Button,鼠标移入listView显示,移出隐藏
private void button2_MouseEnter(object sender, System.Windows.Input.MouseEventArgs e) { listView1.Visibility = Visibility.Visible; } private void button2_MouseLeave(object sender, System.Windows.Input.MouseEventArgs e) { listView1.Visibility = Visibility.Hidden; } //listView有数据需要操作
private void listView1_MouseEnter(object sender, System.Windows.Input.MouseEventArgs e) { listView1.Visibility = Visibility.Visible; } private void listView1_MouseLeave(object sender, System.Windows.Input.MouseEventArgs e) { listView1.Visibility = Visibility.Hidden; }
xaml中用Visibility=“{binding}”进行绑定