Setting styles for RadGridViewRow using DataTemplate

2 posts, 0 answers
  1. Swapnil
    Swapnil avatar
    11 posts
    Member since:
    Nov 2017

    Posted 23 Nov 2017 Link to this post

    Hi Team,

    I would like to set few styles, namely TextDecorations like StrikeThrough, Underline and other styles like Horizontal Alignment, Boldness and Font Style programmatically by creating a FrameworkElementFactory of type Textblock and then assigning the same to a DataTemplate of type GridViewRow, which is then assigned to the ContentTemplateProperty of the GridViewRow; but to no avail.

    Could you please guide me on the same.

    Please let me know if any details/clarifications are required.


    Swapnil Ramteke

  2. Vladimir Stoyanov
    Vladimir Stoyanov avatar
    355 posts

    Posted 27 Nov 2017 Link to this post

    Hi Swapnil,

    You can set the styles you want on the GridViewCell element rather than on the GridViewRow element, because some of the properties' setters won't be respected if you set them on the GridViewRow (for example the TextDecoration which is not inherited).

    I am attaching a sample project where I have set the TextDecoration property through a FrameworkElementFactory to the each of the columns' CellTemplates as suggested in this forum thread. Can you take a look at it and let me know how it fits your scenario?

    I am looking forward to your reply.

    Vladimir Stoyanov
    Progress Telerik
    Want to extend the target reach of your WPF applications, leveraging iOS, Android, and UWP? Try UI for Xamarin, a suite of polished and feature-rich components for the Xamarin framework, which allow you to write beautiful native mobile apps using a single shared C# codebase.
Back to Top