For a speicific column in my WinGrid, I set the ColumnStyle to ColumnStyle.URL. I am then trying to specifiy a specific font color for the cell when the row is selected. I have tried various things such as setting the SelectedAppearance.ForeColor, and tyring to set the ButtonAppearance. ForeColor property, but haven't had any luck. I have had luck with normal text columns, but I am guessing there must be a special method. I was looking at FormattedLinkEditor, but wasn't having any luck. Thank you for your help,
Mike
Thank you very much for the quick help as it provided me the perfect solution. I created this class, and then assigned it to the Ultragrid's DrawFilter.
Hi Mike,
The URL only honors two states: the normal state and the LinkClicked state. So there's no selected appearance for it.
You can acheive what you want using a DrawFilter, though, and it's a pretty simply one. Here's a simple example of what the DrawFilter might look like:
public class SelectedURLDrawFilter : IUIElementDrawFilter { #region IUIElementDrawFilter Members bool IUIElementDrawFilter.DrawElement(DrawPhase drawPhase, ref UIElementDrawParams drawParams) { // We are assuming that we got in here for the TextSectionUIElement in the // BeforeDrawForeGround phase, but that's the only phase we ever return from GetPhasesToFilter. // Get the grid row so we can see if it is selected. // We might also want to do the same thing for the cell to see if it's selected. UltraGridRow row = drawParams.Element.GetContext(typeof(UltraGridRow)) as UltraGridRow; // If we got a row and it is selected if (row != null && row.Selected) { // Change the ForeColor to Red. drawParams.AppearanceData.ForeColor = Color.Red; } // Return false, because we want the element to do it's normal drawing, using the // AppearanceData we changed. return false; } DrawPhase IUIElementDrawFilter.GetPhasesToFilter(ref UIElementDrawParams drawParams) { // Watch for a TextSectionUIElement which is the element that draws URLs. if (drawParams.Element is Infragistics.Win.FormattedLinkLabel.TextSectionUIElement) { // Return DrawForeGround so we can change the color. return DrawPhase.BeforeDrawForeground; } return DrawPhase.None; } #endregion }