Ticket T432094
Visible to All Users
Duplicate

We have closed this ticket because another page addresses its subject:

RowsIterator.DoOperation() in PropertyGridControl does not walk through all rows

PropertyGridControl custom RowOperation doesn't retrieve all properties

created 9 years ago (modified 9 years ago)

Hi there,
I've a propertygrid control linked to a XtraGridView.
At runtime all gridview properties are displayed, but I've some issues when trying to access these properties via code using a custom class.

C#
public class SetVisibleRowOperation : DevExpress.XtraVerticalGrid.Rows.RowOperation {     public List AllowedProperties { get; set; }     public override void Execute(DevExpress.XtraVerticalGrid.Rows.BaseRow row)     {         Console.WriteLine(row.Properties.Caption);         row.Visible = AllowedProperties.Contains(row.Properties.Caption);     } }

I'd like to hide all properties except these:

C#
private void checkPropertyGridRowsVisibility() {     var visibleOperation = new SetVisibleRowOperation()     {         AllowedProperties = new List { "Options", "OptionsBehavior", "OptionsFind", "OptionsView", "AllowFixedGroups",         "AllowPartialGroups", "AutoExpandAllGroups", "AllowFindPanel", "AlwaysVisible", "ShowFooter", "ShowGroupPanel", "ShowIndicator" }     };     propertyGridControl.RowsIterator.DoOperation(visibleOperation); }

But it seems all properties under OptionsView and similar (3rd level) are not accessed  by the iterator ¿?
In the Execute method I can see (when debugging OptionsView property) that row.HasChildren value is TRUE but row.HasChildRows has no items inside ¿?
Plus, there is a Rows property (only visible in the Quickwatch debug window) that is showing the correct items…

Maybe I'm missing something?
The only thing I need is hide all properties that are not in list…

L

Answers approved by DevExpress Support

created 9 years ago (modified 9 years ago)

Hello Lluis,

By default, nested properties are created only when parent properties are expanded. To change this behavior, set the PropertyGridControl.OptionsBehavior.AllowDynamicRowLoading property to false before binding to the object. Also, I suggest you override the NeedsVisitChildren method of the RowOperation descendant as well to gain better performance. I have modified your sample project to illustrate this approach. Please let me know of your results once you have had an opportunity to test it.

See also:
Using the Rows Iterator

    Comments (2)

      Perfect!
      That's what I was looking for… thx Aleks.

      DevExpress Support Team 9 years ago

        I'm happy to hear that the issue has been resolved. Feel free to contact us in case of further questions.

        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.