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

Question: How Do I Change the fontweight of a column

7 Answers 709 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Jorge Gonzalez
Top achievements
Rank 1
Jorge Gonzalez asked on 14 Jan 2010, 10:18 PM
Hello,
     I want to programmatically bold the text that appears in first column of my grid.
Thanks

7 Answers, 1 is accepted

Sort by
0
Milan
Telerik team
answered on 15 Jan 2010, 06:22 AM
Hello Jorge Gonzalez,

This is as easy as creating a very simply CellStyle for your first column. For example:

<telerik:RadGridView Name="playersGrid" Grid.Row="1" AutoGenerateColumns="False"
    ColumnsWidthMode="Auto">
    <telerik:RadGridView.Columns>
        <telerik:GridViewDataColumn DataMemberBinding="{Binding Position}">
            <telerik:GridViewDataColumn.CellStyle>
                <Style TargetType="{x:Type telerik:GridViewCell}">
                    <Setter Property="FontWeight" Value="Bold"/>
                </Style>
            </telerik:GridViewDataColumn.CellStyle>
        </telerik:GridViewDataColumn>
    </telerik:RadGridView.Columns>
</telerik:RadGridView>


Regards,
Milan
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
Jorge Gonzalez
Top achievements
Rank 1
answered on 15 Jan 2010, 03:58 PM
Thanks Milan ,
   I think your approach is used when you define how the grid columns will look prior to loading the data. I came up with a solution (probably not the best) that works. In the RowLoaded event of the grid I typed this line of code:

e.Rows.Cells[0].FontWeight = FontWeights.Bold;
0
bhavik
Top achievements
Rank 1
answered on 24 Mar 2014, 03:58 PM
CellEditTemplate bug:

A Control used in the DataTemplate does not get it's Style Property.

<telerik:GridViewDataColumn DataMemberBinding="{Binding Name,Mode=TwoWay}">
<telerik:GridViewDataColumn.CellTemplate>
<DataTemplate>
<TextBlock Text="{Binding Name}" FontFamily="Arial"/>
</DataTemplate>
</telerik:GridViewDataColumn.CellTemplate>
<telerik:GridViewColumn.CellEditTemplate>
<DataTemplate>
<telerik:RadWatermarkTextBox
Text="{Binding Name,Mode=TwoWay}" Style="{StaticResource RadWatermarkTextBoxStyle}"/>
</DataTemplate>
</telerik:GridViewColumn.CellEditTemplate>
</telerik:GridViewDataColumn>

RadWatermarkTextBoxStyle is not applied.
Setting properties explicitly is a workaround but not a solution; it will restrict Theming.
0
bhavik
Top achievements
Rank 1
answered on 24 Mar 2014, 03:58 PM
this is for silverlight
0
Yoan
Telerik team
answered on 26 Mar 2014, 04:48 PM
Hi,

I've tried to reproduce the problem you report, but to no avail. Please, check the attached project and let me know how it works at your side.

Regards,
Yoan
Telerik
 

Build cross-platform mobile apps using Visual Studio and .NET. Register for the online webinar on 03/27/2014, 11:00AM US ET.. Seats are limited.

 
0
bhavik
Top achievements
Rank 1
answered on 26 Mar 2014, 05:30 PM
I have a simple project for you where the problem is easily reproducible. Your attach files link doesn't allow me to upload the zipped solution. If you can give me your email address, i'll forward it to you for review.
0
Yoan
Telerik team
answered on 31 Mar 2014, 09:21 AM
Hello,

Indeed, you can not attach the project since the forums are allowed only for image attachments. Please open a support ticket and attach your sample project to it so we can test it locally and provide you with further assistance.

Regards,
Yoan
Telerik
 

Build cross-platform mobile apps using Visual Studio and .NET. Register for the online webinar on 03/27/2014, 11:00AM US ET.. Seats are limited.

 
Tags
GridView
Asked by
Jorge Gonzalez
Top achievements
Rank 1
Answers by
Milan
Telerik team
Jorge Gonzalez
Top achievements
Rank 1
bhavik
Top achievements
Rank 1
Yoan
Telerik team
Share this question
or