how to show tooltip over disabled button in UWP?
Button b=new button();
b.IsEnabled=false;
b.content="Button";
ToolTip t= new ToolTip();
t.Content="Hello";
ToolTipService.SetToolTip(b, ToolTip);
how to show tooltip over disabled button in UWP?
Button b=new button();
b.IsEnabled=false;
b.content="Button";
ToolTip t= new ToolTip();
t.Content="Hello";
ToolTipService.SetToolTip(b, ToolTip);
Disabling a button not only changes the style, but also intercepts the triggering of related events.
For example, if disabled, Button will not trigger Pointer
related events. The display condition of the Tooltip
is that the Pointer
is hovering on the control for a period of time. If the control cannot detect the Pointer
event, the Tooltip
will never meet the corresponding trigger.
But if you need it to display, we can change it another way:
var grid = new Grid();
Button b = new Button();
b.IsEnabled = false;
b.Content = "Button";
ToolTip t = new ToolTip();
t.Content = "Hello";
grid.Children.Add(b);
ToolTipService.SetToolTip(grid, t);
We can put Tooltip
on the Grid
that will not be disabled, this can avoid this problem.
Thanks.