locked
How to set ToolTipService.ShowOnDisabled in WinRT for Windows Store app? RRS feed

  • Question

  • Hi.

    I am making Windows store app, and I am adding tooltips to my controls.

    The tooltips of enabled controls is shown as well, but the tooltips of disabled controls is not shown.

    So I searched this issue, and I found "ToolTipService.ShowOnDisabled" property.

    But the property can not be set in my windows store app project.

    I think that the property is not supported on WinRT. Right?

    If it is not supported, how can be shown the ToolTips in the disabled controls?

    Please let me know.

    Thanks!

    Friday, December 21, 2012 6:40 AM

Answers

  • A variant of that solution avoids the use of a Converter altogether:

    <Page
        x:Class="App5.MainPage"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:local="using:App5"
        xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
        mc:Ignorable="d">
    
        <Grid Background="{StaticResource ApplicationPageBackgroundThemeBrush}">
            <!-- Use Fill = Transparent in production -->
            <Rectangle ToolTipService.ToolTip="Me" 
                       Width="{Binding ElementName=b1, Path=ActualWidth}" Height="{Binding ElementName=b1, Path=ActualHeight}" 
                       Fill="Blue" HorizontalAlignment="Left"/>
            <Button x:Name="b1" IsEnabled="False" Content="Go" ToolTipService.ToolTip="You"/>
        </Grid>
    </Page>

    • Proposed as answer by Jesse Jiang Thursday, December 27, 2012 7:54 AM
    • Marked as answer by Jesse Jiang Friday, January 4, 2013 4:47 AM
    Friday, December 21, 2012 8:20 AM

All replies

  • You may try this old Silverlight trick: wrapping the control in a rectangle that overlays your control when it's disabled, and apply the tooltip to that rectangle.
    Friday, December 21, 2012 8:02 AM
  • A variant of that solution avoids the use of a Converter altogether:

    <Page
        x:Class="App5.MainPage"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:local="using:App5"
        xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
        mc:Ignorable="d">
    
        <Grid Background="{StaticResource ApplicationPageBackgroundThemeBrush}">
            <!-- Use Fill = Transparent in production -->
            <Rectangle ToolTipService.ToolTip="Me" 
                       Width="{Binding ElementName=b1, Path=ActualWidth}" Height="{Binding ElementName=b1, Path=ActualHeight}" 
                       Fill="Blue" HorizontalAlignment="Left"/>
            <Button x:Name="b1" IsEnabled="False" Content="Go" ToolTipService.ToolTip="You"/>
        </Grid>
    </Page>

    • Proposed as answer by Jesse Jiang Thursday, December 27, 2012 7:54 AM
    • Marked as answer by Jesse Jiang Friday, January 4, 2013 4:47 AM
    Friday, December 21, 2012 8:20 AM