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

How to change icon for error notification in row header?

6 Answers 87 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Raymond
Top achievements
Rank 1
Raymond asked on 01 Apr 2011, 08:57 AM

Hi

By default if validation for row failed there is icon with exclamation mark in row header (I use GridViewRowInfo.ErrorText to define text for tool tip).

 

I would like to use my own icon. How can I do it?

Regards

6 Answers, 1 is accepted

Sort by
0
Accepted
Richard Slade
Top achievements
Rank 2
answered on 01 Apr 2011, 11:59 AM
Hello Raymond,

Please have a look at my answer here which should answer your question
Hope that helps
Richard
0
Raymond
Top achievements
Rank 1
answered on 04 Apr 2011, 08:45 AM

I have one more question: how can I change location of icon indicated row state (selection, edition …)?

I have tried this but it does not work – icon is still in the center of cell:

 

void RadGridViewCustomErrorIcon_ViewCellFormatting(object sender, CellFormattingEventArgs e)
{
    if (e.CellElement is GridRowHeaderCellElement)
    {
        var cell = (GridRowHeaderCellElement)e.CellElement;
        var ip = (ImagePrimitive)cell.Children[0] as ImagePrimitive;
        //I have tired setting ImageAlignment  and Alignment but it does not work
        cell.ImageAlignment = ContentAlignment.MiddleRight;
        cell.Alignment = ContentAlignment.MiddleRight;
        if (ip.Image != null)
        
            ip.Image = _errorBitmap;
            ip.Location = new Point(-25, ip.Location.Y);
        }
    }
}

Regards
0
Richard Slade
Top achievements
Rank 2
answered on 04 Apr 2011, 09:49 AM
Hi Raymond,

I'm not quite sure what you mean. The error image that you are placing there is an image primitive in the cell. The Cell still contains the arrow image, it's just that it's hidden by the error one. Please could you explain further what you would like to do and I'll try to help
Thanks
Richard
0
Raymond
Top achievements
Rank 1
answered on 04 Apr 2011, 09:58 AM
I am talking about moving this icon to right - check attachment.
0
Richard Slade
Top achievements
Rank 2
answered on 04 Apr 2011, 10:31 AM
As far as I'm aware, you cannot change this currently. If I find a way to change it, I'll let you know.
Regards,
Richard
0
Martin Vasilev
Telerik team
answered on 07 Apr 2011, 08:30 AM
Hi guys,

Actually, there is a way to change the alignment of the picture in GridRowHeaderCellElement. Please consider the following code as an example:
void radGridView1_ViewCellFormatting(object sender, CellFormattingEventArgs e)
{
    GridRowHeaderCellElement rowHeaderCell = e.CellElement as GridRowHeaderCellElement;
 
    if (rowHeaderCell != null)
    {
        rowHeaderCell.ImageLayout = ImageLayout.None;
        rowHeaderCell.ImageAlignment = ContentAlignment.BottomRight;
    }
}

I hope this is helpful. Let me know if you have any other questions.

Best wishes,
Martin Vasilev
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Tags
GridView
Asked by
Raymond
Top achievements
Rank 1
Answers by
Richard Slade
Top achievements
Rank 2
Raymond
Top achievements
Rank 1
Martin Vasilev
Telerik team
Share this question
or