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

PanelBarItems ToolTips

3 Answers 50 Views
PanelBar
This is a migrated thread and some comments may be shown as answers.
Andrey
Top achievements
Rank 1
Andrey asked on 13 Dec 2011, 12:21 PM
Hi. I need help. How i can make ToolTip property for  each Item in my RadPanelBar and bind them to the SQL fields.
I define my PanelBar object and all  property with the help of VB.NET..
Thanks.

3 Answers, 1 is accepted

Sort by
0
Tina Stancheva
Telerik team
answered on 16 Dec 2011, 11:01 AM
Hello Andrey,

If you populate the RadPanelBar.ItemsSource collection with objects from your database, you can set the tooltip in the RadPanelBar.ItemTemplate - set it to the root element defined in the DataTemplate. For example:
<UserControl.Resources>
    <telerik:HierarchicalDataTemplate x:Key="PanelBarItemTemplate" ItemsSource="{Binding Children}">
        <TextBlock Text="{Binding Header}" ToolTipService.ToolTip="{Binding ToolTip}" />
    </telerik:HierarchicalDataTemplate>
 
</UserControl.Resources>
<Grid VerticalAlignment="Stretch">
    <telerik:RadPanelBar x:Name="radPanelBar" ItemTemplate="{StaticResource PanelBarItemTemplate}" />
</Grid>
Give this a try and let me know if it works for you or if I'm missing something.

All the best,
Tina Stancheva
the Telerik team

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

0
Andrey
Top achievements
Rank 1
answered on 20 Dec 2011, 01:42 PM
Thanks. But how i can do this in the VB.NET code.
I don`t understand.

I define my custom header
Dim MyHeader As New RadPanelBarItem() with {.Header = "Header 1"}


and define several custom items
Dim item1 As New TextBlock() With {.Text = "Bla-Bla-Bla"}
Dim item2 As New TextBlock() With {.Text = "Bla-Bla-Bla"}
Dim item3 As New TextBlock() With {.Text = "Bla-Bla-Bla"}
Dim item4 As New TextBlock() With {.Text = "Bla-Bla-Bla"}
Dim item5 As New TextBlock() With {.Text = "Bla-Bla-Bla"}
      MyHeader.Items.Add(item1)
      MyHeader.Items.Add(item2)
      MyHeader.Items.Add(item3)
      MyHeader.Items.Add(item4)
      MyHeader.Items.Add(item5)
       
        RadPanelBar.Items.Add(MyHeader)

Now. How i can define template with only ToolTip property for every  custom items without Header item in this code, If i define

 
<UserControl.Resources>
        <telerik:HierarchicalDataTemplate x:Key="PanelBarItemTemplate">
            <TextBlock ToolTipService.ToolTip="{Binding ToolTip}" />
        </telerik:HierarchicalDataTemplate>
    </UserControl.Resources>
    <Grid x:Name="LayoutRoot" Background="White">
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="271*" />
            <ColumnDefinition Width="615*" />
        </Grid.ColumnDefinitions>
        <telerik:RadPanelBar Height="745"
                             HorizontalAlignment="Left"
                             Margin="10,11,0,0"
                             Name="RadPanelBar1"
                             VerticalAlignment="Top"
                             telerik:StyleManager.Theme="Expression_Dark"
                             ItemTemplate="{StaticResource PanelBarItemTemplate}"
                             Width="251">
     </Grid>

this is not working. Please help.
 
0
Tina Stancheva
Telerik team
answered on 23 Dec 2011, 12:57 PM
Hi Andrey,

My suggestion will work only in a databinding scenario. This means that it will only work if you bind the RadPanelBar.ItemsSource to a collection of data items (read more). I attached a sample project that demonstrates this approach so that you can examine it and decide if it will work for you.

However, if you don't want to change the direction you're using in your application, then you can set up a ToolTip in code like so:
Dim MyHeader As New RadPanelBarItem() With {.Header = "Header 1"}
ToolTipService.SetToolTip(MyHeader, "This is MyHeader")
 
Dim item1 As New TextBlock() With {.Text = "Bla-Bla-Bla"}
ToolTipService.SetToolTip(item1, "This is Item 1")
 
Dim item2 As New TextBlock() With {.Text = "Bla-Bla-Bla"}
ToolTipService.SetToolTip(item2, "This is Item 2")
 
Dim item3 As New TextBlock() With {.Text = "Bla-Bla-Bla"}
ToolTipService.SetToolTip(item3, "This is Item 3")
 
Dim item4 As New TextBlock() With {.Text = "Bla-Bla-Bla"}
ToolTipService.SetToolTip(item4, "This is Item 4")
 
Dim item5 As New TextBlock() With {.Text = "Bla-Bla-Bla"}
ToolTipService.SetToolTip(item5, "This is Item 5")
 
MyHeader.Items.Add(item1)
MyHeader.Items.Add(item2)
MyHeader.Items.Add(item3)
MyHeader.Items.Add(item4)
MyHeader.Items.Add(item5)
 
RadPanelBar.Items.Add(MyHeader)

Both approaches will add tool tips to your items so you can choose the one that better fits your development requirements.

Kind regards,
Tina Stancheva
the Telerik team

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

Tags
PanelBar
Asked by
Andrey
Top achievements
Rank 1
Answers by
Tina Stancheva
Telerik team
Andrey
Top achievements
Rank 1
Share this question
or