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
22
votes
3 answers

Viewing a list of Controls associated with a class in Visual Studio IDE

I'm using the form designer in VS. I placed a label on my form, and then deleted it's text. Currently, I can not locate the label. How do I see a list of controls associated with a given class?
FellowMD
  • 2,142
  • 3
  • 16
  • 15
22
votes
3 answers

Focus on TextBox when UserControl change Visibility

I have a usercontrol loaded inside a canvas; this usercontrol on default have visibility collapsed. When a specific textbox of my window is focused the usercontrol become visible. When usercontrol become visible I want set focus to another textbox…
Luca Petrini
  • 1,695
  • 2
  • 28
  • 53
22
votes
3 answers

User Control as container at design time

I'm designing a simple expander control. I've derived from UserControl, drawn inner controls, built, run; all ok. Since an inner Control is a Panel, I'd like to use it as container at design time. Indeed I've used the…
Luca
  • 11,646
  • 11
  • 70
  • 125
22
votes
1 answer

ASP.NET Custom user control to add dynamically

I have hard time to modify a page that had a Custom User Control directly to the ASPX page and now require to have it dynamically loaded when needed only. The User Control does have html and other controls via the ASCX file and has code in the…
Patrick Desjardins
  • 136,852
  • 88
  • 292
  • 341
22
votes
6 answers

What's the difference betwen a UserControl and a ContentControl?

According to all of the documentation, when you're creating a non-lookless control, you're supposed to subclass UserControl. However, UserControl is a simple subclass of ContentControl but it doesn't appear to add anything to it, interface-wise. …
Mark A. Donohoe
  • 28,442
  • 25
  • 137
  • 286
22
votes
2 answers

Binding to UserControl DependencyProperty

I have created a UserControl with some DependencyProperties (in the example here only one string property). When I instantiate the Usercontrol, I can set the property of the UserControl and it is shown as expected. When I am trying to replace the…
Lightbringer
  • 765
  • 1
  • 4
  • 16
22
votes
6 answers

User control (ascx) and properties

The only way I've found to persist property values within a user control is to use the ViewState. public string Title { get { return Convert.ToString(ViewState["Title"]); } set { ViewState["Title"] = value; } } I can't say I'm…
Jagd
  • 7,169
  • 22
  • 74
  • 107
21
votes
5 answers

How to access properties of a usercontrol in C#

I've made a C# usercontrol with one textbox and one richtextbox. How can I access the properties of the richtextbox from outside the usercontrol. For example.. if i put it in a form, how can i use the Text propertie of the richtextbox??? thanks
Pedro Luz
  • 2,694
  • 4
  • 44
  • 54
21
votes
4 answers

Use user control in the same folder as the page

I get this message at runtime of ASP.NET 2 page : The page 'MyFolder/blabla.aspx' cannot use the user control 'MyFolder/MyControl.ascx', because it is registered in web.config and lives in the same directory as the page. Of course I can separate…
Alex
  • 417
  • 5
  • 13
21
votes
14 answers

How to avoid a "object reference not set to an instance of an object" exception in XAML code at design time?

I have a problem with a wpf usercontrol which is of my own devising. The problem is that I get a object reference not set to an instance of an object exception in XAML code at design time, when I implement the usercontrol in my program. The designer…
Kimbo
  • 1,328
  • 3
  • 9
  • 12
21
votes
3 answers

Get the name of the parent user control WPF C#

I have access to User Control A. I want to get info on User Control C. Is there any way to do this in WPF? The structure is basically what you see. User Control D is a ribbon, C is a tab on the ribbon and B and A are contents of C. I can't seem to…
DotNetRussell
  • 9,716
  • 10
  • 56
  • 111
21
votes
11 answers

Visual studio 2012 XAML designer invalid markup

I've got a project that contains usercontrols. For some reason, the design view for the window which uses the said controls has stopped functioning and insists on "Invalid Markup" - the error given is that some members of the usercontrols are not…
moreyummystuff
  • 231
  • 1
  • 2
  • 5
20
votes
3 answers

Hide control within a WPF User Control Library

I've a project made from the "WPF User Control Library" Template in Visual Studio. This project contains one main usercontrol plus additional Windows/Usercontrols. How can I "hide" these additional Windows/Usercontrols, so that the user can only…
Fred
  • 596
  • 1
  • 6
  • 19
20
votes
2 answers

WPF usercontrol Twoway binding Dependency Property

I created a Dependency Property in the usercontrol, but however changes in the usercontrol was NOT notified to the Viewmodel Usercontrol
Spen D
  • 4,225
  • 9
  • 39
  • 47
20
votes
2 answers

C# WPF : slider going to exact position

I'm using a slider in a WPF window and I want that when the user clicks somewhere on the track of the slider, the thumb to go to that exact position. Currently, when I click somewhere, the thumb goes towards that position, but not to exactly that…
TheQuestioner
  • 427
  • 1
  • 7
  • 23