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

BreadCrumb Search

3 Answers 80 Views
BreadCrumb
This is a migrated thread and some comments may be shown as answers.
James
Top achievements
Rank 1
James asked on 09 May 2013, 04:18 PM
Hi,

I was wondering if it would be possible to add a more detailed search feature to the BreadCrumb bar. I know it currently has a kind of search where typing the name of the item will display matching results for that level (attached currentresults.png). But to get to "Item 1.1.1" I would need to type in "Item 1\Item 1.1\Item 1.1.1". Ideally I'd just like to type in "Item 1.1.1".

I can write the search functionality bit I just need to know what events to listen for (i.e. everytime the user types a letter) and how to display the results.

Any ideas?

Thanks for your help.

3 Answers, 1 is accepted

Sort by
0
Pavel R. Pavlov
Telerik team
answered on 14 May 2013, 07:59 AM
Hi James,

This behavior is not currently supported out-of-the-box. The control shows the items available in the corresponding level. However, you can implement you custom search logic in the handler of the PreviewKeyDown event of the RadBreadcrumb control. As a start you can use this code:

private void Breadcrumb_PreviewKeyDown(object sender, System.Windows.Input.KeyEventArgs e)
{
    var tb = e.OriginalSource as TextBox;
    if (e.Key == System.Windows.Input.Key.Enter)
    {
        if (tb != null)
        {
            /*Custom search logic*/
 
            /*set the Path to the result of your search*/
            this.Breadcrumb.Path = @"Mother company\Item 1\Item 1.1";
        }
    }
}

Kind regards,
Pavel R. Pavlov
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

0
James
Top achievements
Rank 1
answered on 14 May 2013, 11:09 AM
Pavel,

Thanks for your response. Your suggestion does get me closer to my goal! However it doesn't allow me to present a list of search results to the user like the default way does. Is it possible to bind my custom search results to this dropdown list? Or could I override this part of the breadcrumb control with the RadAutoCompleteBox control?
0
Accepted
Tina Stancheva
Telerik team
answered on 17 May 2013, 12:15 PM
Hi James,

Yes, you can use the RadAutoCompleteBox in the RadBreadcrumb ControlTemplate. You can replace the TextBox that is representing the historySplitButton Content with a RadAutoCompleteBox. Then you can TemplateBind the ItemsSource of the AutoCompleteBox to the RadBreadCrumb AutocompleteItems.

Please note that the RadBreadcrumb AutocompleteItems collection has to be manually populated after the RadBreadcrumb control is loaded. Then you'll also have to make sure to change the IsInTextMode state of the Breadcrumb once a selection is made in the AutoCompleteBox. You can implement this logic in the SelectionChanged event handler of the autocomplete control.

Finally, you'll have to manually focus the RadAutoCompleteBox as soon as the user clicks in the RadBreadcrumb and enters its TextMode.

I implemented these suggestions in a sample solution so that you can examine and test them locally. Let us know if they help.

Kind regards,
Tina Stancheva
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

Tags
BreadCrumb
Asked by
James
Top achievements
Rank 1
Answers by
Pavel R. Pavlov
Telerik team
James
Top achievements
Rank 1
Tina Stancheva
Telerik team
Share this question
or