usercontrols

How do I bind UserControl property?

Let's say I have a simple UserControl with no codebehind: <UserControl xmlns= .... x:Class="TrafficLight.LightControl"> <Grid x:Name="LayoutRoot"> <Grid x:Name="Light" > <Ellipse x:Name="MyColor" Fill="{**I need bind this field to UserControl.Foreground**}" Stroke="#FF000000" /> <Ellipse x:Name="Shade" Fill="#E4555555" /> </Grid> ...

C# + Custom graphics on controls?

Hi, I was just wondering if there are ways of creating my own custom winforms controls? I've been plundering with Visual Studio 2008 now trying to do some c# apps. And the GUI end up looking terrible because of the standard winforms limitations. And I noticed that I can add images to buttons for example, but ther's no hover effect. Or,...

Binding Silverlight UserControl custom properties to its' elements

Hi. I'm trying to make a simple crossword puzzle game in Silverlight 2.0. I'm working on a UserControl-ish component that represents a square in the puzzle. I'm having trouble with binding up my UserControl's properties with its' elements. I've finally (sort of) got it working (may be helpful to some - it took me a few long hours), but w...

PasswordRecovery asp.net control

I'm trying to access the submit button which is part of the PasswordRecovery control within asp.net 2.0. The API as far as I can see does not allow this. Has anyone any ideas how I can add a Javascript confirmation popup window when clicking this button. I have tried to add onclick to the attributes of the PasswordRecovery control wi...

User Control Postback

I am working on rendering a set of cart items using a user control. Each cart item can be removed via a button in the user control. When a cart item is removed I need to visually show it's removal. However, since the cart item existed during the loading of the page it remains until the page is refreshed again. What I am after is a means ...

Which method of re-use is better in this case - ascx or other

I've got an ASP.NET application that shows grades for different kinds of students. Some students have a self-paced course that doesn't include late penalties and quizzes, and others have a standard classroom course that does. So, when displaying a student's grade, I determine which category that student falls in, and then render the gra...

User Control populated from request variable in containing page

I have a user control that displays results from a database in a gridview. The containing page receives querystring values and passes them to the user control to load. From the containing page, what is the best way to load and display the user control? Currently, I do the following: Containing Page_Load: Get querystring values Contain...

Silverlight: MouseLeftButtonDown timer to repeatedly fire an event

I am trying to create a custom scrollbar and am using images as button. For now a simple I can handle the MouseLeftButtonDown and Up event just fine but what I'd like to do is while its held down, every so many millisecond trigger an event is fired. I tried something like this but it isn't quite working. Suggestions? public delegat...

Displaying custom icon for custom control?

In visual studio when you create a custom control you get this ugly little purple gear thing for an icon of your control instead of a custom control . So how can I change the icon for my control? ...

Gaining access to literal in user control

Hi All, I have a user control that displays a list of categories. In that user control I have a literal control that I would like to write to from the code behind file. This is my literal How can I get access to write to the user control? What code would I need. I keep getting this error: Object reference not set to an instance of an...

How to set the text of a label inside a user control

Hi All, I have a user control that displays a list of categories. In that user control I have a Label control that I would like to write to from the code behind file. This is my Label I have tried this code: Label lblCount = (Label)this.Page.FindControl("Label1"); lblCount.text = "some text"; How can I get access to write to the l...

Calling a vb linkbutton’s(within a user control) click event from javascript

how can i call a VB function - deleteevent() in usercontrol.ascx.vb from a javascript function in clickhandler(e) in usercontrol.ascx. The call should cause a postback because i need the usercontrol to display the changes. i am currently trying to do it by using a linkbutton with style display:none, and calling its click event from the ...

User Control Templates

I have followed this article on MSDN. The template works fine but i got 2 big problems. I can't access the controls in the template even if i decorate the template with these [TemplateContainer(typeof(MessageContainer))] [PersistenceMode(PersistenceMode.InnerProperty)] [Browsable(false)] [DesignerSerializationVisibility(DesignerSeria...

ASP.NET Repeater control or custom implementation?

Hallo, Recently I have read a couple of posts on varous sites and blogs that ASP.NET Repeater one of the most commonly used and accepted between experienced programmers. Someone actually wrote that he consider the asp.net programmer better if he mentions that he often use this control in a job interview. The fact that I used it rarely ...

Cannot modify expression because it is not a variable

I'm trying to get an UserControl (which has a grid on it) on a Windows Form to resize. The below code is what I have in the Form. The behavior I'm getting is that the control is resized when I make it big. But it does not shrink. What am I doing wrong (or) What am I missing? private void AdjustGrid() { ZoomControl.L...

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 can be named. I tried the following: <UserControl.ContentTemplate> <DataTemplate> ...

WPF MVVM + UserControl with Code Behind.

For some reason I'm having issues Binding a custom User Control up through my ViewModel in an MVVM WPF application. The basic control is a Date entry form with three text boxes. I am using the codebehind for the usercontrol to capture the textchange event and so some manipulation. For some reason Adding Binding to the property never t...

Set DataSource on controls within asp.net UserControl?

I have created my first asp.net UserControl that I will use in several places throughout my app. It contains a FormView to display fields of the record in a DataTable. It all seems fine, except, I can't figure out how to set the DataSource on the FormView that is within the UserControl. I want to set the DataSource in a method in code-b...

User Controls in Windows Forms - Anything similar to ASP.NET User Controls?

Hi all, In ASP.NET you have something called "User Controls", which allow you to design a custom control which can be reused in the website. I am now starting developing a Windows application in .NET 2.0 and (surprisingly) I cannot find a similar functionality. What I would like to do is: - Create a new user control in the designer;...

WinForms open popup usercontrol as menuitem menu dropdown?

Been searching everywhere and can't find a way to do this. I have a menubar across the top of my winforms program. Now it just pops up a normal menuitem menu. I would like to disable that menu and popup a nice looking usercontrol that looks like its the dropdown for that menu item but includes much more customization. A good example wou...