Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
280
Only show expansion indicator when there are children
posted

It seems that in order to only show expansion indicator if there actually is child records to show I have to hook InitializeRecord event and handle it like so:


        private void gridFields_InitializeRecord(object sender, InitializeRecordEventArgs e) {

            if (e.Record != null) {
                if (!e.Record.HasChildren) {
                    e.Record.ExpansionIndicatorVisibility = Visibility.Hidden;
                } else {
                    e.Record.ExpansionIndicatorVisibility = Visibility.Visible;
                }
            }
        }

My grid is bound to a ListCollectionView, and the individual items contains another ListCollectionView, say ChildrenView.

 

Now if I from my view model, add an item to ChildrenView (that did not have any items, so that expansion indicator initially is hidden), how do I get the ExpansionIndicator to reappear?

v.9.1

  • 9694
    posted

    Hello,

    There is a method in the Record class that will reset the ExpansionIndicatorVisibility property:

    ResetExpansionIndicatorVisibility(). 
    This will clear the override that was applied in your gridFields_InitializeRecord method.

    You can try resetting this in the RecordUpdated event.

    Please let me know if you need further help in this.

    Thanks!