RadGridView: GridRowHeaderCellElement

4 posts, 0 answers
  1. Tyler
    Tyler avatar
    13 posts
    Member since:
    Jun 2016

    Posted 25 Aug Link to this post

    When trying to set the image for the GridRowHeaderCellElement, nothing appears.  I have an old theme where this image shows up just fine.

     

    I have attached a comparison.  My old theme (right) and my new theme (left).  My old theme was built from scratch a while back.  My new theme was based on the "Visual Studio 2012 Light" theme.  We gutted the RadGridView to start fresh.

     

    We are trying to set the image to be used as the "selected row indicator" when the row "IsCurrent".

     

    I have tried to embed several images into this element without any success.

     

    Am I doing something wrong or not complete with the theme? 

  2. Dess
    Admin
    Dess avatar
    1605 posts

    Posted 26 Aug Link to this post

    Hello Tyler,

    Thank you for writing. 

    You can control what row header image will be displayed for the current row by the RadGridView.TableElement.CurrentRowHeaderImage property. For the rest of the row header cells you can use the ViewCellFormatting event in order to assign the desired image:
    public Form1()
    {
        InitializeComponent();
        this.radGridView1.TableElement.CurrentRowHeaderImage = Properties.Resources.current;
    }
     
    private void radGridView1_ViewCellFormatting(object sender, Telerik.WinControls.UI.CellFormattingEventArgs e)
    {
        GridRowHeaderCellElement rowHeaderCell = e.CellElement as GridRowHeaderCellElement;
        if (rowHeaderCell != null)
        {
            if (!e.Row.IsCurrent && !string.IsNullOrEmpty(e.Row.Cells["Photo"].Value + ""))
            {
                e.CellElement.ImageLayout = ImageLayout.Zoom;
                e.CellElement.Image = (Bitmap)((new ImageConverter()).ConvertFrom(e.Row.Cells["Photo"].Value)); 
            }
        }
    }

    I hope this information helps. Should you have further questions I would be glad to help.

    Regards,
    Dess
    Telerik by Progress
    Check out the Windows Forms project converter, which aids the conversion process from standard Windows Forms applications written in C# or VB to Telerik UI for WinForms.For more information check out this blog post and share your thoughts.
  3. UI for WinForms is Visual Studio 2017 Ready
  4. Tyler
    Tyler avatar
    13 posts
    Member since:
    Jun 2016

    Posted 26 Aug in reply to Dess Link to this post

    That route works fine and will work for my application. 

    Why does this not function as it seems it should in the Visual Style Builder?

  5. Dess
    Admin
    Dess avatar
    1605 posts

    Posted 29 Aug Link to this post

    Hello Tyler, 

    Thank you for writing back. 

    The TableElement.CurrentRowHeaderImage property can be changed in VisualStyleBuilder as well. However, for ControlDefault theme it doesn't take effect. I have logged it in our feedback portal. You can track its progress, subscribe for status changes and add your vote/comment to it on the following link - feedback item.

    I have also updated your Telerik points.

    Currently, the possible solution that I can suggest is to set the CurrentRowHeaderImage property at run time.

    I hope this information helps. If you have any additional questions, please let me know.

    Regards,
    Dess
    Telerik by Progress
    Check out the Windows Forms project converter, which aids the conversion process from standard Windows Forms applications written in C# or VB to Telerik UI for WinForms.For more information check out this blog post and share your thoughts.
Back to Top