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
275
Adding Button to column header
posted

I am using NetAdvantage for .NET 2008 Vol. 2 CLR 2.0.

I have several questions regarding adding a button to a UltraWinGrid column header and having it do something useful.

Right now, I have managed to create the buttons by using a CreationFilter on the UltraWinGrid; i.e. I set

ugPatientList.CreationFilter = New AddUpdateButtonsCreationFilter()

in the form's Load event.

The function itself is pretty basic:

Public Function BeforeCreateChildElements(ByVal parent As Infragistics.Win.UIElement) As Boolean Implements Infragistics.Win.IUIElementCreationFilter.BeforeCreateChildElements
    
Dim value As Boolean = False

      If TypeOf parent Is HeaderUIElement Then 
          Dim btnElement As ButtonUIElement

         
'parent.ChildElements.Clear()
         
btnElement = New ButtonUIElement(parent)
 

          btnElement.Rect = New Rectangle(parent.Rect.X + 2, parent.Rect.Y, _

                                          CInt(parent.Rect.Width * 0.55), CInt(parent.Rect.Height * .75))
         
btnElement.Text = "Update"

         
'Dim btnToolTip As Windows.Forms.Control = TryCast(parent.ToolTipItem, Windows.Forms.Control)

         
'btnElement.ToolTipItem = Infragistics.Win.ToolTip(btnToolTip)


         
parent.ChildElements.Add(btnElement)

         
value = True

     End If

     Return value

End Function

 

The buttons show up on every column header, but now the captions don't appear!  So I have four questions:

  1. What's the best way to have both the button and caption show up in the header?
  2. How can I turn the Hidden property of a button to True in a difference procedure (i.e. how do I reference the button object outside of this function)?
  3. How do I handle a button's Click-type event?
  4. How do I add a tooltip to the button?

 

Parents
No Data
Reply
  • 9364
    posted

     Hi David, would you mind posting some code that you eventually implemented for getting the button and label?

    Also being very new to CreationFilter I am not sure  how your class AddUpdateButtonsCreationFilter()  relatesto the function BeforeCreateChildElements

     Lastly how did you resolve the tooltip question.

     Thanks!

Children