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

RadBradCrumb seems to be quiet incomplete/unfinished

2 Answers 60 Views
Treeview
This is a migrated thread and some comments may be shown as answers.
Holger
Top achievements
Rank 1
Holger asked on 20 May 2018, 03:48 PM

     RadBradCrumb is a nice idea, but seems to be not really finished.

First, there is no documentation at all.

This little page gives a hint, this thing exists, not more.

https://docs.telerik.com/devtools/winforms/treeview/breadcrumb

 

Second, the splitbuttons and the dropdownItems are nice initialized and working,

but the DefaultItem of the SplitButton is not set.

You cannot click on the Button, und go up the hierarchie, the most basic function of a breadcrumb.

You always have this dropdown-things only.

Additionally, the RadBradCrumb is quiet a Closed thing, there are no events to subscribe, no virtual methods to override, just nothing.

I have found a workaround for this, which makes it work es expected, but this should be default functionality.

public class BreadCrumbHandler
{
    private RadBreadCrumb crumb;
    public BreadCrumbHandler(RadBreadCrumb crumb)
    {
        this.crumb = crumb;
 
        // there is not other access to the DefaultItem of the SplitButtons in the BreadCrumb
        var r = crumb.RootElement.Children.First() as RadBreadCrumbElement;
        r.Items.ItemsChanged += BreadCrumb_ItemsChanged;
    }
 
    private void BreadCrumb_ItemsChanged(RadItemCollection changed, RadItem target, ItemsChangeOperation operation)
    {
        if (operation == ItemsChangeOperation.Inserted)
        {
            RadSplitButtonElement btn = target as RadSplitButtonElement;
            if (btn != null)
            {
                var defaultItem = new RadMenuItem(btn.Text);
                defaultItem.Text = btn.Text;
                defaultItem.Click += DefaultItem_Click;
                btn.DefaultItem = defaultItem;
            }
        }
        else if (operation == ItemsChangeOperation.Clearing)
        {
            foreach (var item in changed.OfType<RadSplitButtonElement>())
            {
                var menuItem = item.DefaultItem as RadMenuItem;
                if (menuItem != null)
                    menuItem.Click -= DefaultItem_Click;
                item.DefaultItem = null;
            }
        }
        else if (operation == ItemsChangeOperation.Removing)
        {
            RadSplitButtonElement btn = target as RadSplitButtonElement;
            if (btn != null)
            {
                var menuItem = btn.DefaultItem as RadMenuItem;
                if (menuItem != null)
                    menuItem.Click -= DefaultItem_Click;
                btn.DefaultItem = null;
            }
        }
    }
 
    private void DefaultItem_Click(object sender, EventArgs e)
    {
        var menuItem = (RadMenuItem)sender;
        var currentNode = crumb.DefaultTreeView.SelectedNode;
        while (currentNode != null)
        {
            if (currentNode.Text == menuItem.Text) // not really safe test, but works as long as Texts are distinct
            {
                crumb.DefaultTreeView.SelectedNode = currentNode;
                return;
            }
            currentNode = currentNode.Parent;
        }
    }
}

 

 

 

 

2 Answers, 1 is accepted

Sort by
0
Hristo
Telerik team
answered on 21 May 2018, 11:13 AM
Hi Holger,

Thank you for writing.

I agree that the documentation for the RadBreadCumb is not complete and that it should be updated. A similar scenario like yours is also discussed in the following forum thread: https://www.telerik.com/forums/getting-breadcrumb-to-act-like-windows-explorer-breadcrumb. In that forum, I have attached a project with a custom control.

Let me know if you need further assistance.

Regards,
Hristo
Progress Telerik
Try our brand new, jQuery-free Angular components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
0
Hristo
Telerik team
answered on 01 Jun 2018, 11:25 AM
Hello Holger,

We have decided to add a new mode in the breadcrumb which will perform a selection in the tree upon clicking on the action part of the split buttons. The item is logged here: ADD. RadBreadCrumb - expose a new mode which will perform a selection in the associated tree view upon clicking on the action part of the split button

The item is planned for the current release which is scheduled for the middle of June. 

Regards,
Hristo
Progress Telerik
Try our brand new, jQuery-free Angular components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
Tags
Treeview
Asked by
Holger
Top achievements
Rank 1
Answers by
Hristo
Telerik team
Share this question
or