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

Underline Cell Contents

9 Answers 165 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Sergey Arutchev
Top achievements
Rank 1
Sergey Arutchev asked on 30 Mar 2010, 03:16 PM
I just upgraded to the 2010 Q1 release, and found that GridViewCell.TextDecorations has been deprecated. What is now the proper way to underline the contents of a cell?

9 Answers, 1 is accepted

Sort by
0
Vlad
Telerik team
answered on 31 Mar 2010, 07:18 AM
Hello,

You can set this property for desired column.

Regards,
Vlad
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
Dan
Top achievements
Rank 1
answered on 13 Dec 2012, 09:43 PM
Why can't you set the cell TextDecorations..I don't want underline for all cells in the column, just particular cells...Is there a way to accomplish this still?
0
Vlad
Telerik team
answered on 14 Dec 2012, 07:46 AM
Hi,

 In this case you need to use CellStyleSelector. 

Kind regards,
Vlad
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

0
Dan
Top achievements
Rank 1
answered on 14 Dec 2012, 07:54 AM
Can you provide an example with columns that are added via code behind and not through xaml?
0
Vlad
Telerik team
answered on 14 Dec 2012, 07:55 AM
Hello,

 Have you checked our demos? Do you have any problems and/or questions?

Kind regards,
Vlad
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

0
R
Top achievements
Rank 1
answered on 24 May 2013, 04:58 PM

I'm using CellStyleSelector but can't figure-out how to apply the underline.

  • GridViewCell does not have a TextDecorations Property
  • TextBlock has a TextDecorations property, but that has no effect on the cell that I can see
<Style x:Key="MyUnderlineStyle" TargetType="{x:Type telerik:GridViewCell}">
    <!--<Setter Property="GridViewCell.TextDecorations" Value="Underline" />-->
    <!--<Setter Property="Teleric:GridCell.TextDecorations" Value="Underline" />-->
    <!--<Setter Property="telerik:GridViewCell.TextDecorations" Value="Underline" />-->
    <Setter Property="TextBlock.TextDecorations" Value="Underline" />
</Style>
0
Vanya Pavlova
Telerik team
answered on 27 May 2013, 11:36 AM
Hi,


The preferable pure XAML oriented approach to achieve your goal is through using CellTemplateSelectors.



Regards,
Vanya Pavlova
Telerik

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

0
R
Top achievements
Rank 1
answered on 28 May 2013, 01:01 PM
You seem to have dodged the whole point of the question.

My XAML works with CellTemplateSelectors. Even with CellTemplateSelectors, you need XAML for your template. The XAML specifies the template to be selected for the cell.

The point of the question is how to get the text decoration for underline. That should be very clear from my post.
0
Vanya Pavlova
Telerik team
answered on 28 May 2013, 01:11 PM
Hi ,



I believe that there is some misunderstanding, so please let me try to explain.
You can get underlined text only and if only you have access to a TextBlock element. Using CellTemplateSelectors you can easily define such TextBlock bound to the corresponding underlying property value and specify its TextDecorations property. On the other hand internally GridViewCell do not expose property such as TextDecorations and you cannot specify it using TextBlock.TextDecorations in a style setter targeted at GridViewCell. By that reason the style you have already defined do not work.
If you take a look at the default template of a GridViewCell you can see a single ContentPresenter, which do not expose TextDecorations property as well.  If you want to achieve your goal using StyleSelectors you should predefine the template of GridViewCell and replace the ContentPresenter element with TextBlock and then you can specify the TextDecorations property. 


I hope that it's much more clear now.
 

Regards,
Vanya Pavlova
Telerik

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

Tags
GridView
Asked by
Sergey Arutchev
Top achievements
Rank 1
Answers by
Vlad
Telerik team
Dan
Top achievements
Rank 1
R
Top achievements
Rank 1
Vanya Pavlova
Telerik team
Share this question
or