This is a migrated thread and some comments may be shown as answers.

How can I get the Expanded/Collapsed Row?

2 Answers 59 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Timothy Liu
Top achievements
Rank 1
Timothy Liu asked on 29 Jul 2010, 05:56 AM
I write these code:

 

 

 

public MainPage()

 

{

InitializeComponent();

 

 

this.gv.AddHandler(GridViewRow.IsExpandedChangedEvent, new RoutedEventHandler(this.RowExpandStatusChanged), true);

 

}

 

 

private void RowExpandStatusChanged(object sender, RoutedEventArgs e)

 

{

 

 

// My logic...

 

 

 

 

}

 

 

 

But, I got this compiler error:
------------------
Error 5 Argument 1: cannot convert from 'Telerik.Windows.RoutedEvent' to 'System.Windows.RoutedEvent' 

2 Answers, 1 is accepted

Sort by
0
Vanya Pavlova
Telerik team
answered on 29 Jul 2010, 07:22 AM
Hello Timothy Liu,

 Use The RowLoadedEvent to achieve desired result,try this code:

private void RowExpandStatusChanged(object sender, RoutedEventArgs e)
      {
 
          MessageBox.Show("Hello World","");
      }
 
 
      private void HierarchicalGridView_RowLoaded(object sender, Telerik.Windows.Controls.GridView.RowLoadedEventArgs e)
      {
          var row = e.Row as GridViewRow;
          if (row != null)
          {
              row.IsExpandedChanged+=new RoutedEventHandler(RowExpandStatusChanged);
          }
          
      }


Kind regards,
Vanya Pavlova
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Timothy Liu
Top achievements
Rank 1
answered on 29 Jul 2010, 08:11 AM
Thank you Vanya!
Tags
GridView
Asked by
Timothy Liu
Top achievements
Rank 1
Answers by
Vanya Pavlova
Telerik team
Timothy Liu
Top achievements
Rank 1
Share this question
or