Questions tagged [user-controls]

A UserControl is a separate, reusable input control that allows a user to interact with an application. User controls can be buttons, checkboxes, input text boxes, mice, keyboards, etc.

A UserControl is a separate, reusable input control that allows a user to interact with an application. User controls can be buttons, checkboxes, input text boxes, mice, keyboards, etc.

User controls only exist on graphical systems or applications. For example, a HTTP service application does not contain user controls; its input is usually by means of a configuration file or a separate application providing it input.

10278 questions
395
votes
22 answers

"The Controls collection cannot be modified because the control contains code blocks"

I am trying to create a simple user control that is a slider. When I add a AjaxToolkit SliderExtender to the user control I get this (*&$#()@# error: Server Error in '/' Application. The Controls collection cannot be modified because the control…
Daniel P
  • 4,217
  • 3
  • 21
  • 15
198
votes
3 answers

What is the difference between a User Control Library and a Custom Control Library?

I am just coming up to speed on WPF and would like to create a reusable WPF control. When I look at the options for creating projects in Visual Studio, I see "WPF User Control Library" and "WPF Custom Control Library". It's unclear to me what the…
17 of 26
  • 27,121
  • 13
  • 66
  • 85
177
votes
10 answers

How do I get the full url of the page I am on in C#

I need to be able to get at the full URL of the page I am on from a user control. Is it just a matter of concatenating a bunch of Request variables together? If so which ones? Or is there a more simpiler way?
RedWolves
  • 10,379
  • 12
  • 49
  • 68
133
votes
7 answers

Disposing WPF User Controls

I have created a custom WPF user control which is intended to be used by a third party. My control has a private member which is disposable, and I would like to ensure that its dispose method will always get called once the containing…
Mark Heath
  • 48,273
  • 29
  • 137
  • 194
119
votes
12 answers

How to fix the flickering in User controls

In my application i am constantly moving from one control to another. I have created no. of user controls, but during navigation my controls gets flicker. it takes 1 or 2 sec to update. I tried to set…
Royson
  • 2,851
  • 13
  • 36
  • 50
116
votes
11 answers

How to create a WPF UserControl with NAMED content

I have a set of controls with attached commands and logic that are constantly reused in the same way. I decided to create a user control that holds all the common controls and logic. However I also need the control to be able to hold content that…
Ryan
  • 1,621
  • 2
  • 13
  • 14
110
votes
11 answers

'UserControl' constructor with parameters in C#

Call me crazy, but I'm the type of guy that likes constructors with parameters (if needed), as opposed to a constructor with no parameters followed by setting properties. My thought process: if the properties are required to actually construct the…
JustLooking
  • 2,405
  • 4
  • 28
  • 38
104
votes
5 answers

How can a WPF UserControl inherit a WPF UserControl?

The following WPF UserControl called DataTypeWholeNumber which works. Now I want to make a UserControl called DataTypeDateTime and DataTypeEmail, etc. Many of the Dependency Properties will be shared by all these controls and therefore I want to put…
Edward Tanguay
  • 189,012
  • 314
  • 712
  • 1,047
93
votes
14 answers

DesignMode with nested Controls

Has anyone found a useful solution to the DesignMode problem when developing controls? The issue is that if you nest controls then DesignMode only works for the first level. The second and lower levels DesignMode will always return FALSE. The…
John Dyer
  • 2,316
  • 1
  • 21
  • 27
92
votes
10 answers

How to redirect to home page in JavaScript?

How can I redirect a user to home page? Example: mywebsite.example/ddfdf/fdfdsf and I want to redirect to mywebsite.example However I want to do it without typing the static name. How can I do this?
Steven Spielberg
86
votes
5 answers

How do I make an Event in the Usercontrol and have it handled in the Main Form?

I have a custom usercontrol and I want to do something relatively simple. When ever a numeric up down in that usercontrol's value changes, have the main form update a display window. This is not a problem if the NUD was not in a usercontrol but I…
Crash893
  • 11,428
  • 21
  • 88
  • 123
84
votes
3 answers

User Control - Custom Properties

I have developed a User Control in Visual Studio (WinForms C#) and have a question. I need the user of my User Control to be able to change certain string values and I would like them to be able to add the user control to their Form and click on it…
jay_t55
  • 11,362
  • 28
  • 103
  • 174
77
votes
4 answers

How do I add my new User Control to the Toolbox or a new Winform?

I have an existing library (not a Winforms application) that supplies some Winforms to a bona-fide Windows application. Within this library, I would like to create a User Control to group some controls together. To accomplish this, I…
Robert Harvey
  • 178,213
  • 47
  • 333
  • 501
76
votes
7 answers

Custom vs User control

I've been reading some explanations about the difference between User and Custom Controls, for example this: http://www.wpftutorial.net/CustomVsUserControl.html I want to create, for example, a simple composition of a datagrid with 2 comboboxes…
Louro
  • 1,413
  • 4
  • 21
  • 27
74
votes
4 answers

Add a user control to a wpf window

I have a user control that I've created, however when I go to add it to the XAML in the window, Intellisense doesn't pick it up, and I can't figure out how to add it to the window.
WedTM
  • 2,587
  • 5
  • 37
  • 54
1
2 3
99 100