I have a column in an UltraWinGrid (Infragistics2.Win.UltraWinGrid.v7.3 Version:7.3.20073.38) and is has a Style of URL. I want to be able to handle a click on the text (link) but ignore clicks in the cell on non-text. I figured I would need to handle the LinkClicked event on the embedded FormattedLinkEditor but cannot determine how do do so. Any guidence would appreciated.
Thanks,
Glenn
FormattedLinkEditor editor = (FormattedLinkEditor) parentGrid.DisplayLayout.Bands[0].Columns["AcceptedCount"].Editor;
Hi Glenn!
glennmcd said:I figured it out: FormattedLinkEditor editor = (FormattedLinkEditor) parentGrid.DisplayLayout.Bands[0].Columns["AcceptedCount"].Editor;editor.LinkClicked += new Infragistics.Win.FormattedLinkLabel.LinkClickedEventHandler(editor_LinkClicked);
editor.LinkClicked += new Infragistics.Win.FormattedLinkLabel.LinkClickedEventHandler(editor_LinkClicked);
Thanks for posting your solution - I really appreciate it!
Regards, Florian
FYI... the grid will share the same editor for all columns using the same Style by default. So the code you have here will actually end up hooking the event for all columns. Which is not neccessarily a bad thing, just something to be aware of.
If you want to hook the event separately for each column, then you need to assign a new FormattedLinkEditor to that column.
Mike Saltzman"] FYI... the grid will share the same editor for all columns using the same Style by default. So the code you have here will actually end up hooking the event for all columns. Which is not neccessarily a bad thing, just something to be aware of. If you want to hook the event separately for each column, then you need to assign a new FormattedLinkEditor to that column.
This doesn't work the way you stated. After configuring with a binding data source and setting up the columns with the designer (setting the Style for two different columns to URL), I added events
FormattedLinkEditor e2 = (FormattedLinkEditor)ugrdSearchResults.DisplayLayout.Bands[0].Columns["col2"].Editor;e2.LinkClicked += new Infragistics.Win.FormattedLinkLabel.LinkClickedEventHandler(e2_LinkClicked);
Result is that the event handlers handle completely independent events. Clicking in one column fires one event, clicking in the other column fires the other event. (Which is good because I DON'T need any logic to determine which column was clicked)
Or is that what you meant by shared?
Hm, that's odd. Are e1 and e2 different objects? Or do they point to the same object?
For most editors, the grid tries to share across columns. But I suppose it's possible that the grid makes an exception in the case of the FormatterLinkEditor for some reason I was not aware of.
Well I stopped it in debug and did ?e1.Equals(e2) and got false, so it looks like they are two different objects.
(In case Equals was overridden, Object.ReferfenceEquals(e1,e2) and e1==e2 return false)
Hm, interesting.
Be that as it may, I would probably still recommend using a separate editor or editor control rather than setting the DataFilter directly on the grid's editor. There are two reasons for this:
1) It may work okay with the FormattedTextEditor, but I am certain that this will not work with other editors.
2) This may be a bug and if it gets fixed in the future, it could cause you some trouble.