.NET Tips and Tricks

Blog archive

More on Working with Infragistics NetAdvantage WinClient

I continue to be impressed by the "little things" in Infragistic's WinClient controls bundle, reviewed in the January issue. For instance, I really liked the NetAdvantage UltraDropDownButton for Windows Forms (though it may just be because I'm working on an app with extremely limited screen space).

In the button's basic configuration, it's a button with a drop down arrow beside it. When the user clicks on the arrow, you can display an UltraPopupContainer holding a container with any control you want. Associating the container with the drop down requires a single line of code:

Me.ultraDropDownButton1.PopupItem = Me.ultraPopupControlContainer1

For my application, I used several of these buttons each displaying, as its Text, a typical date that a user might want to select. But for those cases where the user wanted a special date, I also had a DatePicker on my form that I assigned to the UltraPopupContainer tied to the buttons. If the user wants to accept the default date, they just click the button. When the user wants a "custom" date, they click the drop down arrow, get the standard Windows date picker and select a date they'd prefer. In the button's ClosedUp event, I set the button's Text property to reflect the new date:

Private Sub UltraDropDownButton1_ClosedUp(ByVal sender As Object, 
  ByVal e As System.EventArgs) Handles UltraDropDownButton1.ClosedUp
  Me.UltraDropDownButton1.Text = Me.DateTimePicker1.Text
End Sub

Without requiring any additional screen space, this control let me merge a control for triggering an action (the button) with a control to override my default settings (the DatePicker) without having to go to an "Options" form. Again, not a big, important control but one that solved my problem quickly and, I think, elegantly.

Posted by Peter Vogel on 01/18/2011 at 1:16 PM

comments powered by Disqus