ToolTip Issue for Button

2 posts, 0 answers
  1. azhar
    azhar avatar
    14 posts
    Member since:
    Jul 2010

    Posted 08 Mar 2011 Link to this post

    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">






            <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}"/>









                            <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}"/>























    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




  2. Petar Mladenov
    Petar Mladenov avatar
    2991 posts

    Posted 11 Mar 2011 Link to this post

    Hi azhar,

    You have to set the style of the tooltip likse so:
    <Button Name="Button2" 
                    Content="Show Tool Tip"
                <Button.ToolTip >
                    <ToolTip Style="{StaticResource ToolTipStyle1}" />                

    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!
Back to Top