We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Expanding or Collapsing all Groups

HI All,

Is it possible to Expand and or Collapse all the grouped items in a WPF Card View. 

 I have grouped them like so

cardView.GroupCards("Name");

and would like to Collapse them all initally

regards

Peter

 


1 Reply

HN Harinath Navaneethakrishnan Syncfusion Team January 6, 2023 01:05 PM UTC

Hi Peter,


Currently, we have no support to collapse and expand the groups programmatically, however, you can achieve your requirement by accessing the expander control of the Cardview using a visual tree and changing its IsExpanded property.


Code Snippets:
private void FindExpanders(DependencyObject parent)
{
    int count = VisualTreeHelper.GetChildrenCount(parent);
    for (int i = 0; i < count; i++)
    {
          var child = VisualTreeHelper.GetChild(parent, i);
          if (child is Expander expander)
          {
                expander.IsExpanded = false;
          }
          else
          {
               FindExpanders(child);
           }
     }
}
We have created a simple sample based on your requirement. Please refer to the sample for your reference.


Regards,

Harinath N


Attachment: CardView_4ac1639e.zip

Loader.
Up arrow icon