Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
975
Icon in Rowselector
posted

I got one for ya and feel free to jump in at anypoint to tell me where I've gone wrong.

Concerning data error icons, I want to distinguish between errors and warnings. If I had a warning situation, based on business rules, I want to show a warning icon, an image of my choosing, not the red exclamation point, in both the cell and row selector.  I could'nt find a way to customize the error icon at the ado.net layer, so I moved onto the grid.

So when I have a warning condition for a cell, I do this at the row level: (cell too, but I'll leave that alone for now)

grid.ActiveRow.RowSelectorAppearance.Image = _warningImage;

So now I've got the warning image in the rowselector.  Now I want to show a tooltiop when I hover over the warning image, and I thought I'd use the MouseEnterElement event to look for the rowSelector with the image.

But using the UIElementViewer, surprisingly, I see that the image doesn't register in the viewer.  Nothing at all.  Ths is what I see, just a rowSelectorUIElement:

  RowUIElement, Location = {X=1,Y=150,Width=410,Height=18}
                RowSelectorUIElement, Location = {X=1,Y=151,Width=31,Height=17}


 A regular dataErrorIcon, the out-of-the-box red ! that you get with a datarow.setColumnError(), shows up as an ImageUIElement under a DataErrorIconUIElement. Like this:

 RowCellAreaUIElement, Location = {X=31,Y=150,Width=380,Height=18}
                    CellUIElement, Location = {X=116,Y=151,Width=99,Height=16}
                        DataErrorIconUIElement, Location = {X=117,Y=151,Width=16,Height=16}
                            ImageUIElement, Location = {X=119,Y=153,Width=12,Height=12}

 

So, in a MouseEnterElement event, I get the row object and from that the image from the RowSelectorAppearance:

if (e.Element is RowSelectorUIElement)

{

 

RowSelectorUIElement rs = (RowSelectorUIElement)e.Element;

UltraGridRow row = rs.Row;

//Image imgList = row.RowSelectorAppearance.GetImage(imgList);// rs.Row.RowSelectorAppearance.GetImage(imgList);

Image img = (Image)row.RowSelectorAppearance.Image;if (img != null)

{

Console.WriteLine("Image in rowselector");

}

This works for me but maybe there's a much better way to accomplish this?

Thanks,

Bill

Parents Reply Children
No Data