This is a migrated thread and some comments may be shown as answers.

ToolTip Issue for Button

1 Answer 160 Views
Buttons
This is a migrated thread and some comments may be shown as answers.
azhar
Top achievements
Rank 1
azhar asked on 08 Mar 2011, 04:10 PM
Hi Telerik Team,
        I had created a style for ToolTip and I applied it for a button. But it is not applying and displays System.Windows.Style as a ToolTip. The following is the ToolTip Style which I created.
 

<

 

 

Style x:Key="ToolTipStyle1" TargetType="{x:Type ToolTip}">

 

    

<Setter Property="Template">

 

    

    <Setter.Value>

 

    

        <ControlTemplate TargetType="{x:Type ToolTip}">

 

    

            <Border Height="Auto" Width="200" BorderThickness="2" BorderBrush="#FFB79700" CornerRadius="3">

 

                    <StackPanel Background="{StaticResource ToolTipBackGround}">

 

    

                    <StackPanel Height="25" Width="200" Orientation="Horizontal" HorizontalAlignment="Left" VerticalAlignment="Top" Background="{StaticResource ToolTipHeaderBG}">

 

 

                            <Image x:Name="ImgToolTipIcon" VerticalAlignment="Top" Width="30" Height="22" Source="{Binding ToolTipIcon}" />

 

 

                            <TextBlock Foreground="Black" TextWrapping="Wrap" VerticalAlignment="Top" Margin="2,4,4,0" Height="18" Width="Auto" HorizontalAlignment="Right">

 

 

                                <Run x:Name="RunHeaderText" FontFamily="Andalus" FontSize="14" FontWeight="Bold" Text="{Binding ToolTipHeader}"/>

 

 

                            </TextBlock>

 

 

                        </StackPanel>

 

 

                        <StackPanel Width="200" Orientation="Horizontal" HorizontalAlignment="Left" VerticalAlignment="Top" > 
                            
<TextBlock TextWrapping="Wrap" Foreground="#FFF9F4F4" TextAlignment="Center" Background="{x:Null}" HorizontalAlignment="Right" VerticalAlignment="Top" Width="181" Height="Auto">

 

 

                                <Run x:Name="RunBodyText" FontFamily="Verdana" FontSize="11" FontWeight="Normal" Foreground="#FF151514" Text="{Binding ToolTipText}"/>

 

                            </TextBlock>

 

                        </StackPanel>

 

                    </StackPanel>

 

                </Border>

 

            </ControlTemplate>

 

         

</Setter.Value>

 

     

</Setter>

 

 

</Style>

 

 

 


I had applied the style in the following code:
 

<

 

 

Button Content="Show Tool Tip" Height="23" Margin="288,226,0,0" Name="Button2" VerticalAlignment="Top" HorizontalAlignment="Left" Width="85" ToolTip="{StaticResource ToolTipStyle1}" />


Please let me know any mistakes available in the Style.

Thanks & Regards
Azharshah H

 

 

 

1 Answer, 1 is accepted

Sort by
0
Petar Mladenov
Telerik team
answered on 11 Mar 2011, 05:39 PM
Hi azhar,

You have to set the style of the tooltip likse so:
<Button Name="Button2" 
                Width="85"
                Height="23"
                Margin="288,226,0,0"
                HorizontalAlignment="Left"
                VerticalAlignment="Top"
                Content="Show Tool Tip"
                 >
            <Button.ToolTip >
                <ToolTip Style="{StaticResource ToolTipStyle1}" />                
            </Button.ToolTip>
        </Button>


Best wishes,
Petar Mladenov
the Telerik team
Registration for Q1 2011 What’s New Webinar Week is now open. Mark your calendar for the week starting March 21st and book your seat for a walk through all the exciting stuff we ship with the new release!
Tags
Buttons
Asked by
azhar
Top achievements
Rank 1
Answers by
Petar Mladenov
Telerik team
Share this question
or