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

Tooltip and searching

3 Answers 82 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
Kevin Hendriks
Top achievements
Rank 1
Kevin Hendriks asked on 09 Feb 2012, 01:55 PM
Hello I would like to implement a tooltip that displays multiple fields of my Object.
So far the only solution I have found is creating a Itemtemple with TooltipService.Tooltip filled in.
This work except for one thing, if I do this I must remove DisplayMemberPath="Name".

But if I do this the search funtion does not work anymore.
Meaning if I type "s" it does not jump anymore to the first item that start with an "s" in its name.

How can I resolve this?

3 Answers, 1 is accepted

Sort by
0
Konstantina
Telerik team
answered on 15 Feb 2012, 03:10 PM
Hello,

Could you please share with us some code how do you implement the ToolTip feature and where exactly you want to be shown - on each item or on the ComboBox itself?

Regards,
Konstantina
the Telerik team
Sharpen your .NET Ninja skills! Attend Q1 webinar week and get a chance to win a license! Book your seat now >>
0
Kevin Hendriks
Top achievements
Rank 1
answered on 09 Mar 2012, 02:51 PM
Hello,

The code is as follows
Window1.xaml
<Window
        xmlns:Telerik_Windows_Controls_Chromes="clr-namespace:Telerik.Windows.Controls.Chromes;assembly=Telerik.Windows.Controls" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" x:Class="RadTestProject.Window1"
        Title="Window1" mc:Ignorable="d" Loaded="Window_Loaded">
    <Window.Resources>
 
    </Window.Resources>
        <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="auto" />
            <RowDefinition Height="auto" />
        </Grid.RowDefinitions>
 
        <telerik:RadComboBox Grid.Row="0" x:Name="cbTest2" IsFilteringEnabled="True" TextSearchMode="Contains" DisplayMemberPath="Name" IsSynchronizedWithCurrentItem="False" />
 
        <telerik:RadComboBox Grid.Row="1" x:Name="cbTest" IsFilteringEnabled="True" TextSearchMode="Contains" IsSynchronizedWithCurrentItem="False" >
            <telerik:RadComboBox.ItemTemplate>
                <DataTemplate>
                <Grid Focusable="False" >
                    <Grid.RowDefinitions>
                        <RowDefinition Height="Auto" />
                    </Grid.RowDefinitions>
                    <ToolTipService.ToolTip>
                        <Border CornerRadius="2" VerticalAlignment="Top">
                            <Grid Margin="8" MaxWidth="450" >
                                <Grid.ColumnDefinitions>
                                    <ColumnDefinition Width="Auto" />
                                    <ColumnDefinition />
                                </Grid.ColumnDefinitions>
                                <Grid.RowDefinitions>
                                    <RowDefinition Height="Auto"/>
                                    <RowDefinition Height="Auto"/>
                                </Grid.RowDefinitions>
                                <Label Grid.Column="0" Grid.Row="0" Content="Address" Padding="0"/>
                                <Label Grid.Column="1" Grid.Row="0" Content="{Binding Adress}" Padding="0"/>
                                <Label Grid.Column="0" Grid.Row="1" Content="City" Padding="0"/>
                                <Label Grid.Column="1" Grid.Row="1" Content="{Binding City}" Padding="0"/>
 
                            </Grid>
                        </Border>
                    </ToolTipService.ToolTip>
                    <Label Grid.Column="0" Grid.Row="2" Content="{Binding Name}" Padding="0"/>
                </Grid>
                </DataTemplate>
            </telerik:RadComboBox.ItemTemplate>
        </telerik:RadComboBox>
 
 
    </Grid>
</Window>

Window1.xaml.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using Telerik.Windows.Controls;
using Telerik.Windows.Controls.Scheduler;
using Telerik.Windows.Controls.DragDrop;
using System.Collections.ObjectModel;
 
namespace RadTestProject
{
    /// <summary>
    /// Interaction logic for Window1.xaml
    /// </summary>
    public partial class Window1 : Window
    {
        public Window1()
        {
            RadDragAndDropManager.ExecutionMode = DragExecutionMode.Legacy;
            InitializeComponent();
        }
 
        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            ObservableCollection<Customer> testcol = new ObservableCollection<Customer>();
            testcol.Add(new Customer() { Name = "Acust", Adress = "addr A", City = "city A"  });
            testcol.Add(new Customer() { Name = "Bcust", Adress = "addr B", City = "city B" });
            testcol.Add(new Customer() { Name = "Dcust", Adress = "addr D", City = "city D" });
            testcol.Add(new Customer() { Name = "Gcust", Adress = "addr G", City = "city G" });
            testcol.Add(new Customer() { Name = "Zcust", Adress = "addr Z", City = "city Z" });
            cbTest.ItemsSource = testcol;
            cbTest2.ItemsSource = testcol;
        }
    }
}

Now what I want is the search/filter/jump function of the first combobox. But to be able to display a tooltip per row as in the second combobox.

Regards,
Kevin



0
Accepted
Konstantina
Telerik team
answered on 13 Mar 2012, 12:53 PM
Hello Kevin,

In order to use the text search functionality of the ComboBox when the ItemTemplate is set you will have to set the TextSearch.TextPath attached property. More information you could find in this help article.

Kind regards,
Konstantina
the Telerik team
Sharpen your .NET Ninja skills! Attend Q1 webinar week and get a chance to win a license! Book your seat now >>
Tags
ComboBox
Asked by
Kevin Hendriks
Top achievements
Rank 1
Answers by
Konstantina
Telerik team
Kevin Hendriks
Top achievements
Rank 1
Share this question
or