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

Need to have row separator across width of grid

4 Answers 148 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Chris Smith
Top achievements
Rank 1
Chris Smith asked on 19 Sep 2008, 10:37 AM
Our designer would like us to have a grey row separator across the width of the grid.  At the moment, we can only do this as far right as the right edge of the last defined column.

Is there a way to achieve this?

(We are having a related issue with the mouse-over highlighting for a row.  We would like that to go to right edge of the grid as well.)

Regards

Chris Smith

4 Answers, 1 is accepted

Sort by
0
Atanas
Telerik team
answered on 19 Sep 2008, 01:04 PM
Hi Chris Smith,

I think we have managed to solve your issue. You will merely need to make a minor modification of the GridViewRow template:
<Border Margin="0" Background="{TemplateBinding Background}" HorizontalAlignment="Stretch"

This piece of XAML must look exactly like that: as you probably see the binding of the Width property is removed and the HorizontalAligment value is changed from Left to Strech.

The other thing you need to do is to write a global style targeting GridViewRow:

<Style TargetType="{x:Type telerik:GridViewRow}"
            <Setter Property="Template" Value="{StaticResource GridViewRowTemplate}" /> 
            <Setter Property="Width" Value="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type telerik:RadGridView}}, Path=ActualWidth}"/> 
        </Style> 

I am attaching you a sample project.For the sake of demonstration we have moved the whole XAML code from the theme to the project. But since you already have it, you will just need to make the changes as mentioned above.
I hope this solves your issue.

Best wishes,
Atanas
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Chris Smith
Top achievements
Rank 1
answered on 19 Sep 2008, 01:46 PM
Works perfectly.

Thanks!
0
Will
Top achievements
Rank 1
answered on 04 Nov 2008, 02:08 PM
Hi Atanas,

Chris and I have now discovered that the solution posted here causes odd behaviour when used in conjunction with automatic column sizing, presumably because two competing algorithms (databinding and the column sizing) are trying to set the width of the GridViewRow at the same time?

Do you have any workarounds for this situation?

Kind regards,

Will
0
Atanas
Telerik team
answered on 06 Nov 2008, 06:27 AM
Hi Will,

I did  not succeed in reproducing your issue, everything worked fine at our side. Would you please give me some more details or send a sample project by attaching the files to a new support ticket?

Thank you for your patience.

All the best,
Atanas
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Tags
GridView
Asked by
Chris Smith
Top achievements
Rank 1
Answers by
Atanas
Telerik team
Chris Smith
Top achievements
Rank 1
Will
Top achievements
Rank 1
Share this question
or