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

How do I determine whether a row is already pinned

1 Answer 152 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Chris
Top achievements
Rank 1
Chris asked on 29 Nov 2016, 11:30 PM
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?

1 Answer, 1 is accepted

Sort by
0
Dilyan Traykov
Telerik team
answered on 01 Dec 2016, 12:26 PM
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)
    {
        MessageBox.Show(row.IsPinned.ToString());
    }
    else
    {
        // since the row is not in the viewport, it is not pinned
        MessageBox.Show("False");
    }
}

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

Regards,
Dilyan Traykov
Telerik by Progress
Telerik UI for WPF is ready for Visual Studio 2017 RC! Learn more.
Tags
GridView
Asked by
Chris
Top achievements
Rank 1
Answers by
Dilyan Traykov
Telerik team
Share this question
or