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
1015
Text in the Row Selector column header
posted

Can I place text in the Row Selector column header?

I have set the RowSelectorNumberStyle to RowIndex so I can show line numbers there. But in my situation the line numbers have meaning - they are the "priorities" for the end-user. So I would like to add the word "Priority" as the RowSelectorHeader. There is a TextHAlign and TextVAlign property in  RowSelectorHeader, but there is no Text property.

How can I add the word 'Priority" as the header?

Thanks

  • 40
    Offline posted

    I know this post is old, but it's the top search result for this issue so in the hopes of helping someone in the future -- here's the solution:

    YourGridName.DisplayLayout.Bands[0].Override.RowSelectorHeaderStyle = RowSelectorHeaderStyle.SeparateElement;
    YourGridName.DisplayLayout.Bands[0].Override.RowSelectorWidth = ???;
    YourGridName.DrawFilter = new MyDrawFilter();
    
    
    
    
    class MyDrawFilter : IUIElementDrawFilter
    {
    	public MyDrawFilter()
    	{
    	}
    
    	public DrawPhase GetPhasesToFilter(ref UIElementDrawParams drawParams)
    	{
    		if (drawParams.Element is Infragistics.Win.UltraWinGrid.RowSelectorHeaderUIElement)
    			return DrawPhase.BeforeDrawImage;
    		else
    			return DrawPhase.None;
    	}
    
    	public bool DrawElement(DrawPhase drawPhase, ref UIElementDrawParams drawParams)
    	{
    		if (drawPhase == DrawPhase.BeforeDrawImage && drawParams.Element is Infragistics.Win.UltraWinGrid.RowSelectorHeaderUIElement)
    		{
    			drawParams.DrawString(drawParams.Element.Rect, "MyText", false, false);
    
    			return true;
    		}
    
    		return false;
    	}
    }

  • 20872
    Offline posted

    Hello,

    If you have any other questions with this matter please do not hesitate to ask.

     

  • 69832
    Suggested Answer
    Offline posted

    You can add customized text to these elements using the IUIElementCreationFilter interface (the classname for the row selector element is Infragistics.Win.UltraWinGrid.RowSelectorUIElement).

    Note that you will probably have to set the UltraGrid.DisplayLayout.Override.RowSelectorWidth property to a value that is large enough to accommodate that string value.