Bug Report T296758
Visible to All Users

Ribbon Merging - Quick Access Toolbar items' state is not saved when changing an active MDI child form

created 9 years ago

Hi,
I'm developing a MDI application with merged ribbons. The problem is that the form's quick access toolbar items are not persisted when the focus of the form is lost.

See the attached sample. It is a MDI application with merged ribbon controls.
There are two mdi child forms, each one has a ribbon control, they are merged with the MDI parent ribbon content.
Form2 is started by clicking on menu item New1 and Form3 is started by clicking on menu item New2.
Open both forms in the MDI parent.
Form3 has also a quick access toolbar items. If I deselect some items from the quick access toolbar and I change the focus to Form2, then the unselected quick access items are displayed again when the Form3 is activated.

The archive also contains also two screenshots that depict this behaviour.

Is it possible to persist the state of the Quick Access Toolbar items when the form focus is changed?

Thanks in advance,
Istvan

Comments (1)
DevExpress Support Team 9 years ago

    Hello,
    Thank you for the provided project. I see the described behavior. We need to research it in greater detail, so I've passed this ticket to our developers. We'll get back to you once we have any results.

    Answers approved by DevExpress Support

    created 9 years ago

    We have fixed the issue described in this ticket and will include the fix in our next maintenance update. To apply this solution before the official update, request a hotfix by clicking the corresponding link for product versions you require.

    Note: Hotfixes may be unavailable for beta versions and updates that are about to be released.

    Additional information:

    We've introduced the RibbonControl.BeforeUnMerge event. You can handle it and customize required item links.

      Comments (3)
      DevExpress Support Team 9 years ago

        Here is a code example:

        C#
        private void ribbonControl1_BeforeUnMerge(object sender, DevExpress.XtraBars.Ribbon.RibbonMergeEventArgs e) { List<BarItemLink> linksToRemove = new List<BarItemLink>(); foreach(BarItemLink link in e.MergedChild.Toolbar.ItemLinks) { bool found = false; foreach(BarItemLink mainToolbarLink in this.ribbonControl1.Toolbar.ItemLinks) { if(link.Item == mainToolbarLink.Item) { found = true; break; } } if(!found) linksToRemove.Add(link); } foreach(BarItemLink linkToRemove in linksToRemove) { e.MergedChild.Toolbar.ItemLinks.Remove(linkToRemove); } }
        E E
        Enghouse Systems Limited 9 years ago

          It seems that this issue is not solved. I also added the above piece of code to the main form ribbonControl, but the QAT items are reset when the form focus is changed.
          Could you provide me a sample (or change the one provided by me), maybe I'm doing something wrong.

          DevExpress Support Team 9 years ago

            Hello Valentin,
            The provided code is intended to synchronize deleted items. I have reviewed your screenshot again and now see that you are hiding items instead of deleting them. In this case, you can use the following code:

            C#
            private void RibbonControl1_BeforeUnMerge(object sender, DevExpress.XtraBars.Ribbon.RibbonMergeEventArgs e) { var invisiblleItems = this.ribbonControl1.Toolbar.ItemLinks.OfType<BarItemLink>().Where(l => l.Visible == false).Select(i=>i.Item).ToList(); foreach (BarItemLink linkToRemove in e.MergedChild.Toolbar.ItemLinks) { if (invisiblleItems.Contains(linkToRemove.Item)) { linkToRemove.Visible = false; } }

            I hope this helps.

            Disclaimer: The information provided on DevExpress.com and affiliated web properties (including the DevExpress Support Center) is provided "as is" without warranty of any kind. Developer Express Inc disclaims all warranties, either express or implied, including the warranties of merchantability and fitness for a particular purpose. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.

            Confidential Information: Developer Express Inc does not wish to receive, will not act to procure, nor will it solicit, confidential or proprietary materials and information from you through the DevExpress Support Center or its web properties. Any and all materials or information divulged during chats, email communications, online discussions, Support Center tickets, or made available to Developer Express Inc in any manner will be deemed NOT to be confidential by Developer Express Inc. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.