How do I determine whether a row is already pinned

2 posts, 0 answers
  1. Chris
    Chris avatar
    2 posts
    Member since:
    Nov 2016

    Posted 29 Nov 2016 Link to this post

    I am using RadGridViewCommands.TogglePinnedRowState to "toggle" the pinned value of a GridView row.  However,there are case where I don't know the initial state of the row, so I don't know whether it needs to be "toggled" to pin it or whether it is already pinned (in which case toggling would have the opposite effect of what I want).  How can I retrieve the "pinned" state of a row?
  2. Dilyan Traykov
    Dilyan Traykov avatar
    1171 posts

    Posted 01 Dec 2016 Link to this post

    Hello Chris,

    You can get pinned state of a row by its IsPinned property. Using the GetRowForItem method you can get the row for a particular item. You must, however, make some considerations due to RadGridView's UI virtualization mechanism, which only loads the rows that are currently in the viewport. Here is an example:

    private void Button1_Click(object sender, RoutedEventArgs e)
        // will return the row if it is in the viewport
        var row = this.clubsGrid.GetRowForItem(this.clubsGrid.Items[200]);
        if (row != null)
            // since the row is not in the viewport, it is not pinned

    I hope you find this information helpful. Please let me know if any other questions or concerns arise.

    Dilyan Traykov
    Telerik by Progress
    Telerik UI for WPF is ready for Visual Studio 2017 RC! Learn more.
Back to Top