0
如果我只創建一個工具提示並將它的staysopen屬性設置爲false,它的工作。但是,如果我創建多個工具提示並將其staysopen屬性設置爲false,則只有在鼠標單擊後,我創建的第一個工具提示纔會關閉。其他人保持開放。Wpf多個工具提示staysopen屬性不起作用
爲什麼?
示例代碼:
ToolTip tooltip = new ToolTip { Content = "Password cannot be empty." };
Password_PasswordBox.ToolTip = tooltip;
tooltip.PlacementTarget = Password_PasswordBox;
tooltip.Placement = System.Windows.Controls.Primitives.PlacementMode.Top;
tooltip.IsOpen = true;
tooltip.StaysOpen = false;
ToolTip tooltip2 = new ToolTip { Content = "Username cannot be empty." };
Username_TextBox.ToolTip = tooltip2;
tooltip2.PlacementTarget = Username_TextBox;
tooltip2.Placement = System.Windows.Controls.Primitives.PlacementMode.Top;
tooltip2.IsOpen = true;
tooltip2.StaysOpen = false;