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

RadGridView: GridRowHeaderCellElement

3 Answers 236 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Tyler
Top achievements
Rank 1
Tyler asked on 25 Aug 2016, 09:28 PM

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? 

3 Answers, 1 is accepted

Sort by
0
Dess | Tech Support Engineer, Principal
Telerik team
answered on 26 Aug 2016, 08:59 AM
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.
0
Tyler
Top achievements
Rank 1
answered on 26 Aug 2016, 01:27 PM

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?

0
Dess | Tech Support Engineer, Principal
Telerik team
answered on 29 Aug 2016, 07:51 AM
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.
Tags
GridView
Asked by
Tyler
Top achievements
Rank 1
Answers by
Dess | Tech Support Engineer, Principal
Telerik team
Tyler
Top achievements
Rank 1
Share this question
or