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

IsExpandable Property not retaining programatic settings

1 Answer 53 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Ray
Top achievements
Rank 1
Ray asked on 17 Sep 2013, 05:29 PM
I can not get the row.IsExpandable property to keep it's setting after _RowLoaded event is done firing.  This is the last event that is fired before rendering the screen and handing control over to the user.  I am setting the IsExpandable property to either true or false in the _RowLoaded event.  Even though I am setting the IsExpandable property to false, the toggle button is still visible.  I need it to be collapsed 95% of the time.  Here is my RowLoaded method:

private void fleetGrid_RowLoaded(object sender, RowLoadedEventArgs e)
 {
       var row = e.Row as GridViewRow;
 
       if (row != null)
       {
              Record recItem = e.Row.Item as Record;
              row.IsExpandable = recItem.RequiredFields.ShowToggleOnGrid;
       }
 
}


I am populating the columns in this RadGridView dynamically, and I am using a GridViewToggleRowDetailsColumn along with GridViewDataColumns for the column types.  I only want this toggle button to show if certain properties of the row meet certain conditions, which is what the ShowToggleOnGrid was created for.  I have tried several of the online solutions -provided in the forums, but I can not get the toggle visibility I am looking for.  Any help on this issue would be greatly appreciated.  

1 Answer, 1 is accepted

Sort by
0
Ray
Top achievements
Rank 1
answered on 18 Sep 2013, 02:38 PM
This is the work around that I'm using to get the GridViewToggleColumn behavior that I am looking for:

private void fleetGrid_RowLoaded(object sender, RowLoadedEventArgs e)
        {
            var row = e.Row as GridViewRow;
 
            if (row != null)
            {
                Record recRow = row.Item as Record;
                GridViewCell gvCell = row.Cells[0] as GridViewCell;
 
                if (recRow.RequiredFields.ShowToggleOnGrid)
                {
                    gvCell.Visibility = Visibility.Visible;
                }
                else
                {
                    gvCell.Visibility = Visibility.Collapsed;
                }
 
            }
 
        }
Tags
GridView
Asked by
Ray
Top achievements
Rank 1
Answers by
Ray
Top achievements
Rank 1
Share this question
or