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

4 posts, 0 answers
  1. Sathishraja
    Sathishraja avatar
    2 posts
    Member since:
    Dec 2014

    Posted 30 Dec 2014 Link to this post

    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 . 
  2. Dimitrina
    Admin
    Dimitrina avatar
    3769 posts

    Posted 31 Dec 2014 Link to this post

    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.

     
  3. Sathishraja
    Sathishraja avatar
    2 posts
    Member since:
    Dec 2014

    Posted 31 Dec 2014 in reply to Dimitrina Link to this post

    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

     











  4. Dimitrina
    Admin
    Dimitrina avatar
    3769 posts

    Posted 31 Dec 2014 Link to this post

    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.

     
Back to Top