Ticket T1283099
Visible to All Users

Re: A single pixel border remains visible within the layout control when an item becomes invisible

created 7 months ago

Hello,

I have this same problem, I have checked several tickets about the same problem, but no solution is given and the alternative solutions link returns a 404 error.

Has any solution been developed?
If not, can you tell me the alternative solutions?

Thank you very much.

Answers approved by DevExpress Support

created 7 months ago

Hello,

This is expected behavior, and we described it in the following help topic: Collapse items (Hide items without showing them in the Customization Form).

You can hide a LayoutControlItem with the HideToCustomization method to avoid this behavior. To save the item position, you can save the layout and restore it when you need. You can use LayoutControl.SetDefaultLayout and LayoutControl.RestoreDefaultLayout methods to do this.

C#
private void simpleButton1_Click(object sender, EventArgs e) { if (layoutControlItem1.Visible == true) { layoutControl1.SetDefaultLayout(); layoutControlItem1.HideToCustomization(); } else { layoutControl1.RestoreDefaultLayout(); } }

Please let me know if this is suitable.

    Show previous comments (1)
    Nadezhda (DevExpress Support) 6 months ago

      Hello,

      As far as I understand, different items can be hidden dynamically in your case. If so, I recommend you save the layout where all items are visible and manually call the HideToCustomization method for items that should be hidden after your calculation.

      You can utilize the same technique when you execute a new calculation, and other items should be hidden. In this case, you can restore the previously saved layout with all visible items and hide required items.

      If your end users can display these items again in the same position, you can move these items manually with the RestoreFromCustomization method in the following manner:

      C#
      <your hidden LayoutItem>.RestoreFromCustomization(<visible LayoutItem>, InsertType.Top);

      Please test these techniques and let me know if they meet your requirements.

        Hello
        Thanks for the answer, I continue with the problem becouse when I am going to make a property visible, I do not know which is the previous visible property, therefore I cannot use that solution or I am not understanding you.

        I expose you my case, I have two panels, one with a list of products and another with properties that the user can edit.
        The products are of a type and according to their type some properties are going to be shown in the second panel. The user must not be able to show the properties that we have hidden.
        When changing the product only the properties corresponding to the selected product will be shown.
        Can you give me a solution for this case?

        I don't understand why a blank pixel is left when hiding the LayoutItem, when other elements are hidden they don't leave that pixel. Why can not it work the same way?

        Nadezhda (DevExpress Support) 6 months ago

          Hello,

          Thank you for your follow-up.

          LayoutControl arranges its items with a hierarchical structure to ensure they do not overlap. If you delete one item, the entire structure will be recalculated so that all other items recalculate their position. If you only hide this element, we need to remember the place where it was displayed in this hierarchy structure. The fact is that items next to this item can also be hidden, and we reserve a spot for each item to restore this item in the same position.

          In your use case, since you display properties for a specific type, you can find the properties that are already displayed for this type and pass one of them to the RestoreFromCustomization method.

          If this solution does not meet your requirements, I recommend you consider another control to display your data. For example, you can utilize the Vertical Grid with the Customization Form.

          Please let me know if 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.