RadBradCrumb seems to be quiet incomplete/unfinished

3 posts, 0 answers
  1. Holger
    Holger avatar
    39 posts
    Member since:
    Jan 2015

    Posted 20 May 2018 Link to this post

         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. Hristo
    Admin
    Hristo avatar
    1519 posts

    Posted 21 May 2018 Link to this post

    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.
  3. Hristo
    Admin
    Hristo avatar
    1519 posts

    Posted 01 Jun 2018 Link to this post

    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.
Back to Top