IsExpandable Property not retaining programatic settings

2 posts, 0 answers
  1. Ray
    Ray avatar
    10 posts
    Member since:
    May 2013

    Posted 17 Sep 2013 Link to this post

    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.  

  2. Ray
    Ray avatar
    10 posts
    Member since:
    May 2013

    Posted 18 Sep 2013 Link to this post

    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;
                    }
     
                }
     
            }
Back to Top