usercontrols

WPF UserControl expose ActualWidth

How do I expose the ActaulWidth property of one of the components of my user control to users? I have found plenty of examples of how to expose a normal property by creating a new dependency property and binding, but none on how to expose a read-only property like ActualWidth. cheers. ...

Use Label or DrawString in UserControl

I am writing my own control that will contain a panel with text, images and other media. What is the best way to render the text and images. The control may contain long texts and many images. Should I add the text as labels and images as PictureBox or should I use the DrawString and DrawImage methods to render the text and images? What'...

Textbox anchored to a form on all 4 sides not displayed properly

I'm running into a problem trying to anchor a textbox to a form on all 4 sides. I added a textbox to a form and set the Multiline property to True and the Anchor property to Left, Right, Up, and Down so that the textbox will expand and shrink with the form at run time. I also have a few other controls above and below the textbox. Th...

Building .Net User Controls

I am currently building a .Net userform using C# and I am populating it with custom user controls. The controls each have an accessor that gets and sets the object that contains the data that the control will be populated with. At runtime, everything works great, but at design time I will get errors in the form designer. The errors ar...

Static control with WS_EX_TRANSPARENT style not repainted

Hi all, I am trying to create a control that implements the per-pixel alpha blend while painting a 32-bit bitmap. I extended a CWnd and use static control in the resource editor. I managed to paint the alpha channel correctly but still the static control keep painting the gray background. I overwrote the OnEraseBkgnd to prevent the co...

Is there a quick way to generate a <%@Register...%> line for a user control?

I make a user control and then want to include it on a page I have to always manually type the @Register line at the top of my .aspx file, e.g. <%@ Register TagPrefix="edward" TagName="GetQuote" src="~/Controls/GetQuote.ascx" %> Is there any way to automatically create these @Register lines? (I tried dragging in the .ascx file fro...

WPF: How do I edit the contents of a DockPanel that is located inside a UserControl?

I've created a user control (in vb.net code) that contains two dock panels, one for header content (called HeaderDockPanel) and one for other content (called RootDockPanel). The dockPanels are depedency properties of the user control. These dependency properties are declared as follows: Public Shared ReadOnly RootDockPanelProperty As D...

What is the best way to display nested formulas to business users?

Many of our transactions are comprised of calculations that are comprised of other calculations. How did you represent the hierarchy / execution graph to users? Was there a specific control you found that worked well? How would you project the result of a change to one of the formulas before committing that alteration? One suggesti...

How do you use usercontrols in asp.net mvc that display an "island" of data?

I am trying to find out how to use usercontrols in asp.net mvc. I know how to add a usercontrol to a view and how to pass data to it. What I haven't been able to figure out is how do you do this without having to retrieve and pass the data in every single controller? For example, if I have a user control that displays the most recent ...

A good WPF scrolling timeline control? (fancy datetime picker)

Hi, I'm looking for somthing I can use as a timeline control. A kind of "banner" the user can drag to the left or the right to go forward or backwards in time and then he or she should be able to select a point in time on that control. A fancy datetime picker :-) Any ideas? ...

I want a Master UserControl (a Master page, but for UserControls)

ASP.NET master pages - essential things. However, I have a lot of very similar UserControls in my projects - it might be a standard layout for an AJAX ModalPopup, or something more involved. I wish I could get rid of some of my duplicated code (both in ascx files and code-behind) with some Master UserControls. Does anyone have any sug...

UserControl's RenderControl is asking for a form tag in (C# .NET)

I asked how to render a UserControl's HTML and got the code working for a dynamically generated UserControl. Now I'm trying to use LoadControl to load a previously generated Control and spit out its HTML, but it's giving me this: Control of type 'TextBox' must be placed inside a form tag with runat=server. I'm not actually adding the ...

Debugging a User Control from ASP.NET

I have an ASP.NET (2.0) site. I am on my dev box using V Studio 2008 and IIS. I have a separate User Control project that gets called from a javascript function in the default.aspx page. The User Control project is in another solution. The application is running as expected. The user control is being called and all is well. Well not qui...

how to raise event from dynamically created usercontrol

How do I raise an event from a user control that was created dynamically? Here's the code that I'm trying where Bind is a public EventHandler protected indDemographics IndDemographics; protected UserControl uc; override protected void OnInit(EventArgs e) { uc = (UserControl)LoadControl("indDemographics.ascx"); IndDemographics.B...

How to grab control collection like the Table class does?

How do I grab the controls inside of a UserControl tag? So if this is on a Page: <ME:NewControl ID="tblCustomList" runat="server"> // ... these controls will be used in my UserControl.aspx </ME:NewControl> How do I access those controls in my UserControl? For instance, the Table class does this: <asp:Table ID="tblNormal" runat="ser...

Re-usability of controls within .NET MVC

I only know a small amount about .NET MVC and haven't used it barely at all so far but I was wondering how would you create re-useable controls that can be spread across different applications? We have various controls that have been created in external libraries and we reference the assembly if we want to use them. An example would be ...

user control in a selectable list - best way to do it?

Hello everyone, Working in C# win forms, I'm trying to create a list of items where each item is compromised of an icon and 3 labels in a specific layout. Here's an illustration of it (http://hosting04.imagecross.com/image-hosting-13/3535help.jpg): The user should be able to select a single row, just like in a normal Listview. My fi...

Creating a DIP Switch control in WPF

In an effort to teach myself more about WPF, I'm trying to build a simple application. Where I work we have some hardware that has a bank of 8 dip switches used for setting an address from 0 to 255 (as an 8-bit number). It's a simple concept that I would like to build into a WPF windows application that would allow users to see the dip s...

How to determine type of dynamically loaded usercontrol?

I have an application the will load usercontrols dynamically depending on the user. You will see in the example below that I am casting each user control via switch/case statements. Is there a better way to do this? Reflection? (I must be able to add an event handler Bind in each control.) override protected void OnInit(EventArgs e) {...

How to create a C# Winforms Control that hovers

How can you create a C# Winforms control which goes out of the bounds of its region? Such as a drop down box. Kind of like if you had a DropDownBox in a Small Sized Panel. ...