Questions tagged [controls]

Use this tag for programming scenarios related to controls (interactive elements of the user interface).

A control is an interface element that a computer user interacts with.
Common controls include:

  1. Window A rectangle that represents a "window" into a document, form, or design area.

  2. Text box A box in which to enter text or numbers.

  3. Button An equivalent to a push-button as found on mechanical or electronic instruments.

  4. Hyperlink Text with some kind of indicator (usually underlining and/or color) that indicates that clicking it will take one to another screen or page.

  5. Drop-down list A list of items from which to select. The list normally only displays items when a special button or indicator is clicked.

  6. List box A GUI widget that allows the user to select one or more items from a list contained within a static, multiple line text box.

  7. Combo box A combination of a drop-down list or list box and a single-line textbox, allowing the user to either type a value directly into the control or choose from the list of existing options.

  8. Check box A box which indicates an "on" or "off" state via a check mark ☑ or a cross ☒. Sometimes can appear in an intermediate state (shaded or with a dash) to indicate mixed status of multiple objects.

  9. Radio button A button, similar to a check-box, except that only one item in a group can be selected. Its name comes from the mechanical push-button group on a car radio receiver. Selecting a new item from the group's buttons also deselects the previously selected button.

  10. Cycle button A button that cycles its content through two or more values, thus enabling selection of one from a group of items.

  11. Datagrid A spreadsheet-like grid that allows numbers or text to be entered in rows and columns.

  12. Slider A bar that allows users to make adjustments to a value or process throughout a range of allowed values.

8394 questions
34
votes
10 answers

Is there a way to add an onclick event to an ASP.NET Label server control?

I wanted to do something like this: My Label I know that in Javascript I can do: My Label So I'm wondering why I can't do that with a…
fuentesjr
  • 50,920
  • 27
  • 77
  • 81
33
votes
3 answers

Is it appropriate to extend Control to provide consistently safe Invoke/BeginInvoke functionality?

In the course of my maintenance for an older application that badly violated the cross-thread update rules in winforms, I created the following extension method as a way to quickly fix illegal calls when I've discovered them: /// ///…
Greg D
  • 43,259
  • 14
  • 84
  • 117
33
votes
3 answers

How to get FormControl instance from ControlValueAccessor

I've the following component: @Component({ selector: 'pc-radio-button', templateUrl: './radio-button.component.html', providers: [ {provide: NG_VALUE_ACCESSOR, useExisting: forwardRef(() => FieldRadioButtonComponent), multi:…
Gediminas Bublys
  • 403
  • 1
  • 4
  • 10
33
votes
7 answers

What is the main difference between ReadOnly and Enabled?

In Windows Forms controls, there are two properties: ReadOnly and Enabled. What is the difference between these two properties? I feel like they behave the same way.
Diskdrive
  • 18,107
  • 27
  • 101
  • 167
33
votes
4 answers

How do I customize the WPF StatusBar layout?

Adding more than one child to a WPF StatusBar results in poor layout with little option to customize. For example, this code:
Kent Boogaart
  • 175,602
  • 35
  • 392
  • 393
32
votes
2 answers

How do I make a marquee progress bar in WPF?

In Winforms I could set the ProgressBarStyle of a progress bar to Marqee, and that would have the progress bar incriment on its own without having to be set, for processes where I don't know how long its going to take, and no good way to report back…
Russ
  • 12,312
  • 20
  • 59
  • 78
32
votes
5 answers

What is the best way to simulate a Click with MouseUp & MouseDown events or otherwise?

In WPF most controls have MouseUp and MouseDown events (and the mouse-button-specific variations) but not a simple Click event that can be used right away. If you want to have a click-like behaviour using those events you need to handle both which i…
H.B.
  • 166,899
  • 29
  • 327
  • 400
32
votes
1 answer

How to install build dependencies directly from the debian/control file?

I have a Debian source package, it contains a standard debian/control file, which lists a "Build-Depends:" field. How can I install those build depends without a lot copy and paste? The package is not in Debian repository. So apt-get build-dep won't…
user975135
31
votes
7 answers

WPF: Is there a built-in TreeGrid / TreeListView?

I need something just like this: (I need both the TreeView and the ListView aspects. That is, Hirearchy and Columns.) But, I need it in WPF. is this something that is built in, or am I going to have to build it myself? I assume it has to be…
John Gietzen
  • 48,783
  • 32
  • 145
  • 190
30
votes
3 answers

Align button content

I want the content of a wpf button to be left aligned I tried the following but the text is still centered inside the button.
30
votes
4 answers

How to get instance of Panel that holds content of ItemsControl?

Every ItemsControl has its content stored in Panel right ? We can specify the panel to be used in XAML like this:
Rasto
  • 17,204
  • 47
  • 154
  • 245
30
votes
3 answers

Programmatically Add Controls to WPF Form

I am trying to add controls to a UserControl dynamically (programatically). I get a generic List of objects from my Business Layer (retrieved from the database), and for each object, I want to add a Label, and a TextBox to the WPF UserControl and…
user210757
  • 6,996
  • 17
  • 66
  • 115
30
votes
11 answers

WebBrowser control caching issue

I am using the WebBrowser control inside a Windows Form to display a PDF. Whenever the PDF is regenerated, however, the WebBrowser control only displays its local cached version and not the updated version from the server. I am using the Refresh()…
Gurpreet Singh
  • 1,641
  • 3
  • 17
  • 29
29
votes
11 answers

How to detect that Ctrl+R was pressed?

I'm coding a function in jquery that executes if Ctrl+R is pressed but I can't seem to find out what the left and right ctrl keycodes are... Can someone please help? UPDATE ///this works $(document).keydown(function(e){ …
sadmicrowave
  • 39,964
  • 34
  • 108
  • 180
29
votes
2 answers

WPF: What is the generic container control?

In HTML the generic container control is a DIV. It doesn't do a anything on its own, but it makes for a great place to hang stuff off. Likewise in WinForms the generic container control was the Panel. Again, this is what I would use as a place…
Jonathan Allen
  • 68,373
  • 70
  • 259
  • 447