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

[Solved] How to change the GridRowView template?

4 Answers 128 Views
GridView
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Weiqi
Top achievements
Rank 1
Weiqi asked on 08 Sep 2010, 09:55 AM
i want to add a bold line at the bottom of the row and want to change the template of GridRowView, but i don't want to break the original features.
so, how to make the template to achieve my requirement?

Thanks

4 Answers, 1 is accepted

Sort by
0
Kalin Milanov
Telerik team
answered on 13 Sep 2010, 08:16 AM
Hi Weiqi,

Actually there is no need to edit the template of the row. You can define only a style for it and set its the BorderThickness to a value of your choice. The tricky part here is to set both the BorderBrush of the row and the HorizontalGridLineBrush to the same color to the same color to get the desired result.

Attacked I am sending you a sample to get you started. I hope you will find it useful.

Greetings,
Kalin Milanov
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Minwei
Top achievements
Rank 1
answered on 13 Sep 2010, 09:23 AM
Hi Milanov,

Thanks for your reply. But my requirement is bold grid row line evey 5(or else) rows. So my idea is to create a GridRowView template with bold line and apply it  for specific rows.

Thanks,
0
Kalin Milanov
Telerik team
answered on 13 Sep 2010, 10:16 AM
Hello Minwei,

If you want to change the style of every (let's say 5th row) there is a way to do that without editing the template by utilizing the alternate row style. Simply add a x:Key to the style I have sent you and use this resource for the AlternateRowStyle property. Then set the AlternationCount property of the grid to the value of your choice (4 in this case). 

Attached I am sending you an updated sample with this approach. 

Alternatively if you have more complex logic for underlining the rows you can implement it in C# and then use RowStyleSelector or RowTemplateSelector to apply the style or template as needed. You can use this example as reference.

If you still want to use a custom template for the row - I havre provided that in the XAML too.

Let me know how this goes.

Greetings,
Kalin Milanov
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Minwei
Top achievements
Rank 1
answered on 13 Sep 2010, 10:31 AM
Hello Milanov

Thanks very much. This is what I want to do.
Thanks again for your excellent work.

Thanks,
Weiqi
Tags
GridView
Asked by
Weiqi
Top achievements
Rank 1
Answers by
Kalin Milanov
Telerik team
Minwei
Top achievements
Rank 1
Share this question
or