I need the Expand / Collapse for RowDetailsTemplate

前端 未结 5 929
北荒
北荒 2020-12-09 09:56

I have a DataGrid. It has DataGrid.RowDetailsTemplate. When a button is clicked it should Expand / Collapse; how would I do that?

&         


        
5条回答
  •  一整个雨季
    2020-12-09 10:35

    Include Collapsed and expanded events as below

       
       
                
                    
                
            
        
    

    In the code behind

     private void exp_Collapsed(object sender, RoutedEventArgs e)
            {
                this.dataGrid1.RowDetailsVisibilityMode = DataGridRowDetailsVisibilityMode.Collapsed;
            }
    
            private void exp_Expanded(object sender, RoutedEventArgs e)
            {
                this.dataGrid1.RowDetailsVisibilityMode = DataGridRowDetailsVisibilityMode.VisibleWhenSelected;
            }
    

提交回复
热议问题