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

Setting GridViewRow.IsPinned through style

3 Answers 310 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Christian
Top achievements
Rank 1
Christian asked on 15 Dec 2016, 11:51 AM

Hi

I'm trying to data-bind the IsPinned-property of the GridViewRow to a value from my model.

After numerous unsuccessful tries, I tried setting the IsPinned property to true through a style (see below).

However, the row is not pinned, also the button does not reflect the Pinned state.

How can I set the IsPinned-property through a property of my model?

 

01.<telerik:RadGridView Grid.Row="2" ItemsSource="{Binding Path=CalculablePersons}" GroupRenderMode="Flat" PinnedRowsPosition="Top">
02.    <telerik:RadGridView.Resources>
03.        <Style TargetType="{x:Type telerik:GridViewRow}" BasedOn="{StaticResource {x:Type telerik:GridViewRow}}">
04.            <Setter Property="IsPinned" Value="True" />
05.        </Style>
06.    </telerik:RadGridView.Resources>
07. 
08.    <telerik:RadGridView.Columns>
09.        <telerik:GridViewPinRowColumn />
10.        <telerik:GridViewDataColumn Header="Name" DataMemberBinding="{Binding Path=Name}" />
11.    </telerik:RadGridView.Columns>
12.</telerik:RadGridView>

3 Answers, 1 is accepted

Sort by
0
Stefan
Telerik team
answered on 19 Dec 2016, 01:28 PM
Hello Christian,

This requirement can be achieved through the usage of the TogglePinnedRowState ICommand. Please, take a look at the Commands section of the Pinner Rows topic.

Hopefully, this helps.

Regards,
Stefan X1
Telerik by Progress
Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
0
Christian
Top achievements
Rank 1
answered on 19 Dec 2016, 01:42 PM

Hello Stefan

I'm sorry, but this is not the solution I'm looking for. The TogglePinnedRowState command cannot be bound to a boolean property through a style.

The above style that I posted would accomplish exactly what I need, however, the IsPinned property is not pinning rows, only the command does.

I think this is a bug that needs to be fixed, because the IsPinned property is not marked as read-only, I would expect that the above style works.

0
Stefan
Telerik team
answered on 22 Dec 2016, 10:38 AM
Hello Christian,

The IsPinned property of GridViewRow is actually not meant to be set externally. It is internally bound to the Button through which the user pins a given row through the UI. As stated in my previous reply, the built-in mechanism for such requirement is to utilize the TogglePinnedRowState ICommand.

Regards,
Stefan X1
Telerik by Progress
Want to extend the target reach of your WPF applications, leveraging iOS, Android, and UWP? Try UI for Xamarin, a suite of polished and feature-rich components for the Xamarin framework, which allow you to write beautiful native mobile apps using a single shared C# codebase.
Tags
GridView
Asked by
Christian
Top achievements
Rank 1
Answers by
Stefan
Telerik team
Christian
Top achievements
Rank 1
Share this question
or