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

Background color change of particular cell in telerik grid (WPF)

3 Answers 1350 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Sathishraja
Top achievements
Rank 1
Sathishraja asked on 31 Dec 2014, 05:20 AM
I want to change background color of a particular cell programmatic-ally in wpf telerik radgridview, I have referred  various examples which you have given that using static columns like  (telerik.GridViewDataColumn).

but in my project GridViewDataColumn are not static, it comes dynamically using collections. In this situation how we can handle this? .

please help me as soon as possible . 

3 Answers, 1 is accepted

Sort by
0
Dimitrina
Telerik team
answered on 31 Dec 2014, 08:28 AM
Hello,

I believe you can achieve your goal to conditionally style the cells applying a CellStyleSelector for the column. You can check our documentation on how the CellStyleSelector works.

Regards,
Dimitrina
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
0
Sathishraja
Top achievements
Rank 1
answered on 31 Dec 2014, 08:52 AM
Already I have go through that documentation, which contains columns could be set number of columns, but in our project columns are not static, it comes dynamically. 

I have given below the piece of code from my project. hope you can understand (commonData:GridViewBindingBehavior.ColumnsCollection)

 <telerik:RadGridView Grid.Row="1" Grid.Column="0"
                                     Name="grdPriorityList" 
                                     ItemsSource="{Binding Source={StaticResource PrirorityVM},Path=PriorityListCollection}"
                                     commonData:RadGridViewRowDoubleClickHandler.MethodName="ShowReportDetails" 
                                     commonData:GridViewBindingBehavior.ColumnsCollection="{Binding Source={StaticResource PrirorityVM},Path=DynPriorityListColumns}" 
                                     SelectedItem="{Binding Source={StaticResource PrirorityVM},Path=SelectedRow}"



Below codes are taken from your documentation. I can see here three columns only you have added.

<telerik:RadGridView.Columns>
<telerik:GridViewDataColumn DataMemberBinding="{Binding Name}"/>
<telerik:GridViewDataColumn DataMemberBinding="{Binding Established}"
Header="Est."
DataFormatString="{}{0:yyyy}"/>
<telerik:GridViewDataColumn DataMemberBinding="{Binding StadiumCapacity}"
Header="Stadium"
CellStyleSelector="{StaticResource stadiumCapacityStyle}"
DataFormatString="{}{0:N0}"/>
</telerik:RadGridView.Columns>   

Let me know your ideas.


Regards
Sathishraja

 











0
Dimitrina
Telerik team
answered on 31 Dec 2014, 12:03 PM
Hi Sathishraja,

You can set the CellStyleSelector per column when you add it to the DynPriorityListColumns collection dynamically. Do you have any problem doing this?

Regards,
Dimitrina
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
Tags
GridView
Asked by
Sathishraja
Top achievements
Rank 1
Answers by
Dimitrina
Telerik team
Sathishraja
Top achievements
Rank 1
Share this question
or