Multiple rows cannot be pinned simultaneously

8 posts, 1 answers
  1. Uday
    Uday avatar
    7 posts
    Member since:
    Sep 2011

    Posted 30 Sep 2011 Link to this post

    Hello all,

    This is my first post after i started working with Telerik Radcontrols for winforms.
    Currently i would like to select multiple rows from the grid and i would like to pin them all (either at top or bottom).

    At present, eventhough it is possible to select multiple rows, only the first row is pinned.

    Is it possible to extend the rad grid row header context menu, item click event handler ? such an event handler is really available in the first place ? Kindly throw some light guys....
  2. Answer
    Emanuel Varga
    Emanuel Varga avatar
    1336 posts
    Member since:
    May 2010

    Posted 30 Sep 2011 Link to this post

    Hello Ulday,

    Apparently there is a problem with the row pinning mechanism when multi select is active, for the moment you can use the following workaround: Register for the ContextMenuOpening and do the following:

    private void _radGridView_ContextMenuOpening(object sender, ContextMenuOpeningEventArgs e)
    {
        if (e.ContextMenuProvider is GridRowHeaderCellElement)
        {
            var pinnedStateItem = e.ContextMenu.Items[0] as RadMenuItem;
            if (pinnedStateItem == null)
            {
                e.Cancel = true;
                return;
            }
     
            foreach (RadMenuItem menuItem in pinnedStateItem.Items)
            {
                switch (pinnedStateItem.Items.IndexOf(menuItem))
                {
                    case 0:
                        menuItem.Tag = PinnedRowPosition.None;
                        break;
                    case 1:
                        menuItem.Tag = PinnedRowPosition.Top;
                        break;
                    case 2:
                        menuItem.Tag = PinnedRowPosition.Bottom;
                        break;
                }
     
                menuItem.MouseDown -= new MouseEventHandler(menuItem_MouseDown);
                menuItem.MouseDown += new MouseEventHandler(menuItem_MouseDown);
            }
        }
    }
     
    private void menuItem_MouseDown(object sender, MouseEventArgs e)
    {
        var menuItem = sender as RadMenuItem;
        if (menuItem == null)
        {
            return;
        }
     
        var pinState = menuItem.Tag != null ? (PinnedRowPosition)menuItem.Tag : (PinnedRowPosition.None);
     
        foreach (var selectedRow in _radGridView.SelectedRows.ToArray().Where(selectedRow => selectedRow != _radGridView.SelectedRows.Last()))
        {
            selectedRow.PinPosition = pinState;
        }
    }

    Hope this helps, if you have any other questions or comments, please let me know,

    Best Regards,
    Emanuel Varga

    Telerik WinForms MVP
  3. UI for WinForms is Visual Studio 2017 Ready
  4. Uday
    Uday avatar
    7 posts
    Member since:
    Sep 2011

    Posted 01 Oct 2011 Link to this post

    Thank you so much Emanuel.  Its working great!
    However, unpinning the pinned rows doesnt seem to be possible since the multi-select (rubber rectangle) feature is not working over pinned rows. Is that a known bug ?
  5. Uday
    Uday avatar
    7 posts
    Member since:
    Sep 2011

    Posted 03 Oct 2011 Link to this post

    Hi Emanuel,

    The multi-select option for pinned rows is still not working. Does the gridview control have any events for translucent rectangle ? so that i can hook my code in that

    regards,
    Uday
  6. Emanuel Varga
    Emanuel Varga avatar
    1336 posts
    Member since:
    May 2010

    Posted 03 Oct 2011 Link to this post

    Hello again,

    To get this fixed in a future release i would suggest opening a support ticket with a link to this post.

    For a workaround it's not that easy, because i don't remember exactly where is the selection initiated, i will try to dig into this problem some more tonight and i will get back to you.

    Best Regards,
    Emanuel Varga

    Telerik WinForms MVP
  7. Martin Vasilev
    Admin
    Martin Vasilev avatar
    1061 posts

    Posted 04 Oct 2011 Link to this post

    Hello guys,

    There is not an easy work-around to made the translucent selection rectangle to work for the pinned rows. We will improve this in one of the next releases. For the time being, pinned rows can be selected by Ctrl+Mouse Click combination.

    We also will consider including built-in support for pinning multiple rows at once in the future.

    Uday, I have updated your Telerik points for bringing this to our attention. Let us know if you have any additional questions.

    Greetings,
    Martin Vasilev
    the Telerik team

    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

  8. Uday
    Uday avatar
    7 posts
    Member since:
    Sep 2011

    Posted 04 Oct 2011 Link to this post

    Hi Martin,

    Thanks for adding those points. But still i couldnt able to create a support ticket for this issue. Can you tell me whats wrong. Am always pointed to the "three step" page.
  9. Martin Vasilev
    Admin
    Martin Vasilev avatar
    1061 posts

    Posted 07 Oct 2011 Link to this post

    Hi Uday,

    In order to create a new support thread you need to be logged into your account, than go to "Your Account" -> "Get Support", and there you will see a "Contact Support Team" option. Please keep in mind that you required to be a licensed customer with a valid subscription or a user with a Trial support package to create support enquiry.

    Regards,
    Martin Vasilev
    the Telerik team

    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

Back to Top
UI for WinForms is Visual Studio 2017 Ready