5 Answers, 1 is accepted
0
Accepted
Emanuel Varga
Top achievements
Rank 1
answered on 29 Oct 2010, 08:15 AM
Hello,
You can achieve the desired functionality by registering to the CellFormatting event, and check for that specific column, please take a look at the following example:
Hope this helps, if you have any other questions or comments, please let me know,
Best Regards,
Emanuel Varga
You can achieve the desired functionality by registering to the CellFormatting event, and check for that specific column, please take a look at the following example:
void radGridView1_CellFormatting(object sender, CellFormattingEventArgs e){ if (e.CellElement.ColumnInfo.Name == "YOUR_COLUMN_NAME") { e.CellElement.ForeColor = Color.Blue; e.CellElement.GradientStyle = Telerik.WinControls.GradientStyles.Solid; e.CellElement.BackColor = Color.Red; e.CellElement.Font = new Font(e.CellElement.Font, FontStyle.Underline); e.CellElement.DrawFill = true; } else { e.CellElement.DrawFill = false; e.CellElement.ResetValue(LightVisualElement.ForeColorProperty, Telerik.WinControls.ValueResetFlags.Local); e.CellElement.ResetValue(LightVisualElement.BackColorProperty, Telerik.WinControls.ValueResetFlags.Local); e.CellElement.ResetValue(LightVisualElement.GradientStyleProperty, Telerik.WinControls.ValueResetFlags.Local); e.CellElement.ResetValue(LightVisualElement.FontProperty, Telerik.WinControls.ValueResetFlags.Local); }}Hope this helps, if you have any other questions or comments, please let me know,
Best Regards,
Emanuel Varga
0
Vidhya
Top achievements
Rank 1
answered on 29 Oct 2010, 08:26 AM
thank you very much...
its working...
its working...
0
Asish
Top achievements
Rank 1
answered on 12 Jan 2011, 02:59 PM
I am not getting cell formmatting event in xaml..Please help me
0
Richard Slade
Top achievements
Rank 2
answered on 12 Jan 2011, 04:04 PM
Hello,
It looks like your question might be for the Silverlight forums. If that's the case, please re-direct your question there.
Thanks
Richard
It looks like your question might be for the Silverlight forums. If that's the case, please re-direct your question there.
Thanks
Richard
0
Hello Vidhya,
2.You may also use the CellTemplateSelectors to apply some different datatemplate in specific column, please follow this link.
If you need any additional information please let me know.
Kind regards,
Vanya Pavlova
the Telerik team
CellFormatting event is specific to our RadGridView/WinForms and there is no exact equivalent in our RadGridView/Silverlight. You may use several approaches to achieve the same result based on your project requirements.
Some of the possible options are listed below:
1.You can create named styles targeted at GridViewCell and apply this style in RadGridView's columns as it is shown below:
<UserControl xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation" x:Class="SilverlightApplication147.MainPage" Width="640" Height="480"> <UserControl.Resources> <Style x:Key="a1" TargetType="telerik:GridViewCell"> <Setter Property="Background" Value="Red"/> <Setter Property="Foreground" Value="Black"/> <Setter Property="FontWeight" Value="Bold"/> </Style> <Style x:Key="a2" TargetType="telerik:GridViewCell"> <Setter Property="Background" Value="Blue"/> <Setter Property="Foreground" Value="Yellow"/> <Setter Property="FontStyle" Value="Italic"/> </Style> <Style x:Key="a3" TargetType="telerik:GridViewCell"> <Setter Property="Background" Value="Black"/> <Setter Property="Foreground" Value="PeachPuff"/> </Style> </UserControl.Resources> <Grid x:Name="LayoutRoot" Background="White" DataContext="{Binding Source={StaticResource SampleDataSource}}"> <telerik:RadGridView AutoGenerateColumns="False" ShowColumnFooters="True" ItemsSource="{Binding Collection}"> <telerik:RadGridView.Columns> <telerik:GridViewDataColumn CellStyle="{StaticResource a1}" Header="Price" DataFormatString="{}{0:c}" DataMemberBinding="{Binding Property1}"/> <telerik:GridViewDataColumn CellStyle="{StaticResource a2}" Header="Name" DataMemberBinding="{Binding Property3}"/> <telerik:GridViewDataColumn CellStyle="{StaticResource a3}" Header="CompanyName" DataMemberBinding="{Binding Property4}"/> </telerik:RadGridView.Columns> </telerik:RadGridView> </Grid></UserControl>2.You may also use the CellTemplateSelectors to apply some different datatemplate in specific column, please follow this link.
If you need any additional information please let me know.
Kind regards,
Vanya Pavlova
the Telerik team
Let us know about your Windows Phone 7 application built with RadControls and we will help you promote it. Learn more>>