为什么这个工具提示仍然启用?
Why is this tooltip still enabled?
我正在开发 WPF 应用程序,我正在尝试有条件地启用工具提示。这很奇怪,我意识到即使我明确地将工具提示设置为未启用 (ToolTipService.IsEnabled="False"
),工具提示仍然会显示。谁能弄清楚这里发生了什么?
<TextBlock Grid.Row="2"
Grid.Column="0"
VerticalAlignment="Center"
FontSize="15"
ToolTipService.IsEnabled="False"
Visibility="{Binding IsConnected, Converter={StaticResource BooleanToVisibilityConverter}}">
<fa:ImageAwesome Icon="{Binding Path=BatteryLevelIcon, UpdateSourceTrigger=PropertyChanged}"
Height="20"
Width="20"
Foreground="Green"
Visibility="{Binding IsConnected, Converter={StaticResource BooleanToVisibilityConverter}}" />
<ToolTipService.ToolTip>
<TextBlock>
<TextBlock.Text>
<MultiBinding StringFormat="{}{0}%">
<Binding Path="BatteryPercentage" />
</MultiBinding>
</TextBlock.Text>
</TextBlock>
</ToolTipService.ToolTip>
</TextBlock>
设置ToolTipService.ShowOnDisabled = false;
我正在开发 WPF 应用程序,我正在尝试有条件地启用工具提示。这很奇怪,我意识到即使我明确地将工具提示设置为未启用 (ToolTipService.IsEnabled="False"
),工具提示仍然会显示。谁能弄清楚这里发生了什么?
<TextBlock Grid.Row="2"
Grid.Column="0"
VerticalAlignment="Center"
FontSize="15"
ToolTipService.IsEnabled="False"
Visibility="{Binding IsConnected, Converter={StaticResource BooleanToVisibilityConverter}}">
<fa:ImageAwesome Icon="{Binding Path=BatteryLevelIcon, UpdateSourceTrigger=PropertyChanged}"
Height="20"
Width="20"
Foreground="Green"
Visibility="{Binding IsConnected, Converter={StaticResource BooleanToVisibilityConverter}}" />
<ToolTipService.ToolTip>
<TextBlock>
<TextBlock.Text>
<MultiBinding StringFormat="{}{0}%">
<Binding Path="BatteryPercentage" />
</MultiBinding>
</TextBlock.Text>
</TextBlock>
</ToolTipService.ToolTip>
</TextBlock>
设置ToolTipService.ShowOnDisabled = false;