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

Event when user pins/unpins a row

2 Answers 121 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Thomas
Top achievements
Rank 1
Iron
Thomas asked on 07 Dec 2018, 07:48 AM

Hello,

I have a grid with a GridViewPinRowColumn and I need to detect, when the user has pinned or unpinned a row. Is there an event which I can subscribe?

Best regards,
Thomas

2 Answers, 1 is accepted

Sort by
0
Accepted
Vladimir Stoyanov
Telerik team
answered on 11 Dec 2018, 05:36 PM
Hello Thomas,

Currently there isn't such an event, however you can bind the IsPinned property of the row to a property in your model. Here is what I have in mind:
<Style TargetType="telerik:GridViewRow">
            <Setter Property="IsPinned" Value="{Binding IsPinned, Mode=TwoWay}" />
        </Style>

Please, give this approach a try and let me know if it works for your scenario.

Regards,
Vladimir Stoyanov
Progress Telerik
Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
Martin
Top achievements
Rank 2
Iron
Iron
Iron
commented on 19 Jan 2022, 12:22 PM | edited

There is a strange behavior using this method. 

When the GridView renders an item, the IsPinned property is reset to false... 

meaning : I'm getting a PropertyChanged event on my items that are bound to IsPinned, when the GridView renders. 

This means that i somehow needs to have a flag that locks change notifications while the GridView is rendering :-/

To make matters even worse - There is no reliable event that tells me when the GridView has finished rendering !!!!

Stenly
Telerik team
commented on 24 Jan 2022, 09:35 AM

Hello Martin,

I have provided an answer to this forum thread that was opened regarding this matter. Could you give the approach, that was suggested there, a try? If you have any further questions regarding this, please forward them to the proposed forum. 

0
Thomas
Top achievements
Rank 1
Iron
answered on 12 Dec 2018, 08:31 AM

Hello Vladimir,

thanks for your reply. In the meantime I have found a workaround accessing the private property PinnedItemsView:

PropertyInfo pinnedProperty = typeof(DataItemCollection).GetProperty("PinnedItemsView", BindingFlags.NonPublic | BindingFlags.Instance);
QueryableCollectionView pinnedItems = pinnedProperty.GetValue(myGrid.Items) as QueryableCollectionView;
pinnedItems.CollectionChanged += ...

 

But I will try your approach to make this less hacky.

Best regards,
Thomas

Tags
GridView
Asked by
Thomas
Top achievements
Rank 1
Iron
Answers by
Vladimir Stoyanov
Telerik team
Thomas
Top achievements
Rank 1
Iron
Share this question
or