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

Listbox Drag & Drop Example - Tooltip

1 Answer 57 Views
ListBox
This is a migrated thread and some comments may be shown as answers.
ITA
Top achievements
Rank 1
ITA asked on 18 May 2012, 12:17 PM
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

1 Answer, 1 is accepted

Sort by
0
George
Telerik team
answered on 29 May 2012, 04:25 PM
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 >>

Tags
ListBox
Asked by
ITA
Top achievements
Rank 1
Answers by
George
Telerik team
Share this question
or