Set DetailsVisibility in code

2 posts, 0 answers
  1. Raymond
    Raymond avatar
    24 posts
    Member since:
    Apr 2009

    Posted 04 Jan 2010 Link to this post

    Hi,

    I want to show the details for a specifict row in the grid. I can do this today if I have a button in one cell in the row like this:

    Button

     arr = (Button)sender;

     

     

    parentRow = arr.ParentOfType<Telerik.Windows.Controls.GridView.

     

     

    GridViewRow>();

     

    //Toggle-like functionality

     

    if (parentRow.DetailsVisibility == Visibility.Visible)

    parentRow.DetailsVisibility =

    Visibility.Collapsed;

     

    else

     

    parentRow.DetailsVisibility =

    Visibility.Visible;

    But I want to open the details from anywhere. For example I have a button which add a new post in the grid and I want to open this post/rows details. How do I do that?

    Thanks,

    /R

     

     

     

     

     

  2. Raymond
    Raymond avatar
    24 posts
    Member since:
    Apr 2009

    Posted 04 Jan 2010 Link to this post

    I solved it:

     

    grd.UpdateLayout();

    Telerik.Windows.Controls.GridView.

    GridViewRow row = grd.ItemContainerGenerator.ContainerFromItem(newPost) as Telerik.Windows.Controls.GridView.GridViewRow;

     

    row.DetailsVisibility =

    Visibility.Visible;

     

  3. DevCraft banner
Back to Top