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
1705
What's the best way to make rows bold/not bold at runtime?
posted

Depending on the data, some rows need to be bold and some not bold.  Right now I'm using:

e.Row.CellAppearance.FontData.Bold = Infragistics.Win.DefaultableBoolean.True;

 to make a row bold.  But the problem is, the rows that AREN'T bold then have a little icon of a pen in the RowHeader area, as if someone is editing them.  How can I avoid this pen stuff?

  • 469350
    Offline posted

    If you are seeing a pencil icon on a row, then something is editing the data in that row. There is no reason why setting the Font to bold should have any effect on this.

    My guess is that you have an unbound column in your grid and you are populating the values of the cells in tis column in code. What you should do in a case like this is call Update on the row after you make the changes. This commits the changes to the row so it no longer has pending changes. 

  • 918
    posted

    This has been discussed so many times there really needs to be a grid.appearance item to disable it.  I have a remove pencil class that uses a draw filter to remove (or add whatever) to the row header.  To use it just declare the class  dim rp=new clsremovepencil then put this line in the form load event:  mygridname.DrawFilter = rp.  

    I actually think one of the ingragistics guys posted this a couple or more years ago. It didn't work exactly the way I needed so I commented a bit of stuff out. As is it removes the pencil all the time.  I think it might have been written to remove the pencil part of the time.  Good luck

    Imports Infragistics.Win

    Imports Infragistics.Win.UltraWinGrid

    Public Class clsRemovePencilImplements IUIElementDrawFilter

     

    Public Function GetPhasesToFilter(ByRef drawParams As _

    Infragistics.Win.UIElementDrawParams) As Infragistics.Win.DrawPhase _

    Implements Infragistics.Win.IUIElementDrawFilter.GetPhasesToFilter

    ' Drawing RowSelector Call DrawElement Before the Image is Drawn

    If TypeOf drawParams.Element Is _

    Infragistics.Win.UltraWinGrid.RowSelectorUIElement Then

    Return DrawPhase.BeforeDrawImage

    Else

    Return DrawPhase.None

    End If

    End Function

     

    Public Function DrawElement(ByVal drawPhase As _

    Infragistics.Win.DrawPhase, ByRef drawParams As _

    Infragistics.Win.UIElementDrawParams) As Boolean Implements _

    Infragistics.Win.IUIElementDrawFilter.DrawElement

    ' If the image isn't drawn yet, and the UIElement is a RowSelector

    If drawPhase = drawPhase.BeforeDrawImage And TypeOf _

    drawParams.Element Is _

    Infragistics.Win.UltraWinGrid.RowSelectorUIElement Then

    ' Get a handle of the row that is being drawn

    Dim row As UltraGridRow = _

    CType(drawParams.Element.GetContext(Type.GetType("UltraGridRow")), _

    UltraGridRow)

    ' If the row being draw is the active row

    If row.IsActiveRow Then

    ' Draw an arrow

    drawParams.DrawArrowIndicator(ScrollButton.Right, _

    drawParams.Element.Rect, _

    UIElementButtonState.Indeterminate)

    ' Return true, to stop any other image from being drawn

    Return True

    End If

    End If

    ' Else return false, to draw as normal or true to stop pencil

    'Return False

    Return True

    End Function

     

    End Class