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

Styling RadGridView Cells.

4 Answers 849 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Willy Vidable
Top achievements
Rank 1
Willy Vidable asked on 03 Oct 2010, 04:20 PM

I have a GridView with several columns. I am using a subset of columns to the right to show bars like a kind of Gantt chart.

I want to style the cells in the rows in such a way that each Cell merge with the cell to its left and the cell to its right (no merge with above or below cells) in order to produce the impression that there is a horizontal bar created by setting the background color.

I set up padding and also margin to (0,10, 0,10) in the Cell Template and hidden the columns vertical  lines but I still get a gap between the cells.
I also created a GridViewCellStyle copied from the default as suggested in the documentation, I assigned to the DataColumns tag but make no difference. I can't get rid of the gaps. So I may be doing something wrong.

1. Could you be so kind of tell me how can I get this result.

2. I need to change the name of the columns header dynamically. I can do it from code behind but if I want to do it from XAML how I do that?

Thanks

4 Answers, 1 is accepted

Sort by
0
Kalin Milanov
Telerik team
answered on 07 Oct 2010, 09:13 AM
Hello Willy,

Attached I am sending you a sample which colorizes the cell red and sets the style in a way to allow one cell to flow onto another without them being separated. 

As for the header, you can use the header property of the column and bind it to whatever you need. 

I hope this will be useful.

Sincerely yours,
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
Willy Vidable
Top achievements
Rank 1
answered on 08 Oct 2010, 12:32 AM
Thabnks ofr the answeryour solution works for me.
Just for the record I want to share the code 
<Style x:Key="GridViewCellStyle1" TargetType="{x:Type telerik:GridViewCell}">
               <Setter Property="Background" Value="{StaticResource BlueButtonBackground}" />
               <Setter Property="Padding" Value="0" />
               <Setter Property="Margin" Value="0,5" />
           </Style>
I am using for my solution based on the support team response. The style is defined in the Grid.Resurces area.
The style is applied in the following way:
<telerik:RadGridView.Columns >
. . . . 
. . . . 
                  
                <telerik:GridViewDataColumn DataMemberBinding="{Binding M1}" Header="M1" CellStyle="{StaticResource GridViewCellStyle1}"
                         CellTemplateSelector="{StaticResource myCellTemplateSelector}" />

Thanks a lot.
0
Alex
Top achievements
Rank 1
answered on 08 Oct 2010, 04:57 PM
Hi!
I'm new in this forum. I son't know how to create new Thread.
But I have a question about RadGridView Cell:
If I want that in my grid , the cells that contains only specific text will be highlighted,
but not whole cell, only that specific word.

How can I do that?



0
Vanya Pavlova
Telerik team
answered on 13 Oct 2010, 02:39 PM
Hi Alex,

I suggest you to see the following blog post that describes how to implement Highlighting Inline search for RadGridView for Silverlight.

All the best,
Vanya Pavlova
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
Tags
GridView
Asked by
Willy Vidable
Top achievements
Rank 1
Answers by
Kalin Milanov
Telerik team
Willy Vidable
Top achievements
Rank 1
Alex
Top achievements
Rank 1
Vanya Pavlova
Telerik team
Share this question
or