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
37
votes
1 answer

WPF share column width between separate grids

I have the following setup on my WPF UserControl: ...
devdigital
  • 34,151
  • 9
  • 98
  • 120
36
votes
1 answer

Ambiguous type reference. A type named `VisualState` occurs in at least two namespaces

What is the following error? Ambiguous type reference. A type named 'VisualState' occurs in at least two namespaces, 'System.Windows' and 'System.Windows'. Consider adjusting the assembly XmlnsDefinition attributes. UserControl:
mrJack
  • 1,001
  • 6
  • 17
  • 33
36
votes
2 answers

How to create WPF usercontrol which contains placeholders for later usage

I'd better ask the question by example. Let's say I have UserControl and Window which uses this control. I would like to design this control (named MyControl) in such way (this is sci-fi syntax!):
greenoldman
  • 16,895
  • 26
  • 119
  • 185
36
votes
7 answers

Strange Error - CS0012: The type x is defined in an assembly that is not referenced

The type 'x' is defined in an assembly that is not referenced. You must add a reference to assembly 'abc123'. I have a .NET 2.0 web application that references my assembly 'abc123'. The assembly exists in the GAC and I've verified that it is the…
Mike T
  • 415
  • 2
  • 5
  • 9
35
votes
5 answers

Provide value on 'System.Windows.Markup.StaticResourceHolder' threw an exception

I am using http://blogs.microsoft.co.il/blogs/justguy/archive/2009/01/19/wpf-combobox-with-checkboxes-as-items-it-will-even-update-on-the-fly.aspx?CommentPosted=true#commentmessage example to show selected items in the same combobox seperated by…
Sunny
  • 3,185
  • 8
  • 34
  • 66
35
votes
5 answers

Baseline snaplines in custom Winforms controls

I have a custom user control with a textbox on it and I'd like to expose the baseline (of the text in the textbox) snapline outside of the custom control. I know that you create a designer (inherited from ControlDesigner) and override SnapLines to…
Mike
  • 1,445
  • 1
  • 11
  • 14
35
votes
5 answers

Global Exception Handling for winforms control

When working on ASP.NET 1.1 projects I always used the Global.asax to catch all errors. I'm looking for a similar way to catch all exceptions in a Windows Forms user control, which ends up being a hosted IE control. What is the proper way to go…
Alex
  • 1,576
  • 2
  • 15
  • 28
35
votes
2 answers

Difference between DesignWidth and Width in UserControl in WPF

When I create a new UserControl in WPF, studio creates some XAML:
mohammad
  • 1,248
  • 3
  • 15
  • 27
34
votes
9 answers

Get access to parent control from user control - C#

How do I get access to the parent controls of user control in C# (winform). I am using the following code but it is not applicable on all types controls such as ListBox. Control[] Co = this.TopLevelControl.Controls.Find("label7", true); Co[0].Text =…
Farid-ur-Rahman
  • 1,809
  • 9
  • 31
  • 47
34
votes
6 answers

Inheriting from a UserControl in WPF

I am fairly new to WPF and I am having a problem with inheriting from a user control. I created a User Control and now I need to inherit from that control and add some more functionality. Has anyone does this sort of thing before? Any help would be…
user35129
  • 343
  • 1
  • 3
  • 6
34
votes
9 answers

How can I get the parent page from a User Control in an ASP.NET Website (not Web Application)

Just as the subject asks. EDIT 1 Maybe it's possible sometime while the request is being processed to store a reference to the parent page in the user control?
JoeB
  • 2,743
  • 6
  • 38
  • 51
33
votes
4 answers

How to render a formula in WPF or WinForms

Update 2018 TL;DR; LaTEX for WPF https://github.com/ForNeVeR/wpf-math Original question I need to have a way to draw a mathematical formula in Windows Forms or WPF. Some "FormulaTextBox" control would be exactly what I need. I'm not asking about…
MajesticRa
  • 13,770
  • 12
  • 63
  • 77
33
votes
5 answers

Window vs User Control

Is there a difference between window and user control? It seems to me that these two are exactly the same. So which one should I use and when? (I tried googling this phrase and I couldn't find anything)
user360330
32
votes
2 answers

asp.net: what's the page life cycle order of a control/page compared to a user contorl inside it?

I have an aspx and inside it an ascx. From a short testing I see the PageLoad of the aspx is called before the PageLoad of the user-Control but the opposite is true for OnInit. Does someone know what is the order of the events (page compared to a…
Elad Benda
  • 35,076
  • 87
  • 265
  • 471
32
votes
1 answer

VS Designer question. How to change parent control

VS beginner question. How to change parent control of a control? Example. I have TabControl on form, aligned to fit the all form. I have double clicked of toolStrip control to create menu and instead of the form toolStrip was added to TabControl.…
Tomas
  • 17,551
  • 43
  • 152
  • 257