Listbox Drag & Drop Example - Tooltip

2 posts, 0 answers
  1. ITA
    ITA avatar
    383 posts
    Member since:
    Aug 2009

    Posted 18 May 2012 Link to this post

    Hi,

    i'm using the Listbox Drag & Drop example as base of my ListBox. I use also a ItemTEmplate + DataTemplate. But how do i add my own TooltipTemplate to the ListboxItems?

    i found an example for a tooltip template:

    <Style x:Key="{x:Type ToolTip}" TargetType="ToolTip">
                <Setter Property="OverridesDefaultStyle" Value="true"/>
                <Setter Property="HasDropShadow" Value="True"/>
                <Setter Property="Template">
                    <Setter.Value>
                        <ControlTemplate TargetType="ToolTip">
                            <Border CornerRadius="7" HorizontalAlignment="Center" VerticalAlignment="Top" Padding="5" BorderThickness="3,3,3,3">
                                <Border.Background>
                                    <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
                                        <GradientStop Color="#CF181818" Offset="0"/>
                                        <GradientStop Color="#BE1C1C1C" Offset="1"/>
                                    </LinearGradientBrush>
                                </Border.Background>
                                <Border.BorderBrush>
                                    <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
                                        <GradientStop Color="#80FFFFFF" Offset="0"/>
                                        <GradientStop Color="#7FFFFFFF" Offset="1"/>
                                        <GradientStop Color="#FFFFF18D" Offset="0.344"/>
                                        <GradientStop Color="#FFFFF4AB" Offset="0.647"/>
                                    </LinearGradientBrush>
                                </Border.BorderBrush>
                                <StackPanel>
                                    <TextBlock FontFamily="Tahoma" FontSize="11" Text="{Binding Name}" Foreground="#FFFFFFFF" />
                                </StackPanel>
                            </Border>
                        </ControlTemplate>
                    </Setter.Value>
                </Setter>
            </Style>

    But how bin this Template to my DataItems?

    thanks
    regards
    rene
  2. George
    Admin
    George avatar
    1332 posts

    Posted 29 May 2012 Link to this post

    Hi Rene,

    You don't need to change the ControlTemplate for the ToolTip. I would suggest setting the ToolTip using Implicit style for the RadListBoxItem, for example:

    <Style TargetType="telerik:RadListBoxItem">
                <Setter Property="ToolTip">
                    <Setter.Value>
                        <!--Place here the tooltip content-->
                    </Setter.Value>
                </Setter>
            </Style>

    Hope this helps.

    All the best,
    George
    the Telerik team

    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

  3. UI for WPF is Visual Studio 2017 Ready
Back to Top