usercontrols

Making WPF user control mark click events as handled

I have a custom controls which propagates the mouse click event up the visual tree and I would like to get rid of this behaviour. Is there a way to mark a routed event (which was raised by button click or other mouse event) as handled from xaml in my UserControl. ...

How do I retrieve the control contents in a dynamic table?

I have a page where I would like to collect information about x number of users. I have a control where you enter in the number of users and based off of that number, I create a dynamic table with a row for each user. Each table row has textbox controls that I would like to retrieve the value from on postback. How can this be accomplish...

WPF: Validation on a UserControl

Hi everyone, this is probably very simple, but I can't seem to figure it out... I'm currently using a UserControl to replace form fields to input text on a touch screen. This UserControl is essentially a Button displaying the current text and a pen icon, opening a separate screen keyboard window when pressed. It also needs to validat...

Add additional content into a known content placeholder from a user control.

I have a UserControl that has some javascript I'd like to inject into a known ContentPlaceHolder. I was hoping to do something like the following except when I append to add the control to found control I get an exception which says I cannot modify the control collection in the Init, Load or PreRender events: "UserControl.ascx" <%@ C...

Making input form rotate in 3d using WPF (like silverlight planeprojection)

I am looking at updating the UI of one of my projects that currently uses Winforms and i was hoping to use WPF. I have used silverlight for a while and wanted to use the same PlaneProjection effects to basically rotate my form (by form i mean a group of input controls) along the Y axis. After looking over the interwebs it looks like for...

UserControl In Repeater

I created a userControl "MyControl". I want that the Repeater consists it. Repeater code <asp:Repeater ID="Repeater1" runat="server" > <ItemTemplate> <mc:MyControl ID="myControl" runat="server" /> </ItemTemplate> </asp:Repeater> MyControl consists Button. Code: public partial class MyControl : System.Web.UI.UserControl { publ...

How to create custom composite control derived from the FrameworkElement

Can you give me an example how to create custom composite control (in Silverlight 4) which derives directly from the FrameworkElement. Here is a mockup: public sealed class CompositeImage : FrameworkElement { private readonly List<Image> images; public CompositeImage() { images = new List<Image>(); images.Ad...

c# cross-thread error with UserControls

Here is my situation: I instantiated a c# usercontrol on a main thread, but it is not added to the form. //global declaration usercontrol1 datacontrol; constructor() { ....... datacontrol = new usercontrol1(); ........ } I then have an asyhcnronous background thread that fires an event that is handled by the instantiated data...

Dynamically loaded user control with Event Handlers - Unregister

I have a form with a panel on which I dynamically load multiple user controls. I handle events for each of these controls. UserControl userControl1 = LoadControl("control.ascx") as UserControl; userControl1.Event += new ControlEventHandler(userControl_Event); this.Panel.Controls.Add(userControl1); UserControl userControl2 = LoadControl...

Postbacks and Databinding -- Skipping through part of the page lifecycle?

Ok, I have a UserControl. In it is a textbox and other such things and a save button. I have this UserControl within a Repeater control in the ItemTemplate. Now whenever I first run it, it seems to work fine. When I change the contents of the textbox and go to save it however I get all sorts of null reference errors. The most confu...

Retrieve values entered through a usercontrol

I have a usercontrol consisting of two DateTimePicker This component must be reusable and should expose properties which define, for example, the Visibility of elements, the WIDTH of the container, etc.. And of course, I'm able to retrieve the values entered. So I created adequate DependencyProperty public DateTime StartDateVal...

Can I call a modal popup extender's (which is in one user control) show method from other user control?

I have two user controls. One is having a ModalPopupExtender which I need to show on a click of hyperlink button which is other user control. Is it possible? Can I anyhow call a modal popup extender's Show() method from other user control? ...

Change UserControl template at runtime

Is it possible to change the ascx file used by a usercontrol at runtime? For example in my page i have <ctl:SampleControl runat="server" /> in the web.config I have <controls> <add tagPrefix="ctl" tagName="SampleControl" src="~/UserControls/SampleControl.ascx" /> </controls> At runtime I would like to be able to change the ascx to...

MVC Partial Login Control

Hi All, All im trying to do is create a login control that i want to place within my home page. Ive created a Login User Control as follows: <%@ Control Language="VB" Inherits="System.Web.Mvc.ViewUserControl(Of MyWebsite.LogOnModel)" %> <% Using Html.BeginForm() %> <%: Html.ValidationSummary(True, "Login was unsuccessful. Please co...

how to access property in usercontrol.ascx from usercontrol.ascx.cs

Hello all, I want create for paging a usercontrol. How can I access properties in usercontrol.ascx from usercontrol.ascx.cs? Property in usercontrol.ascx.cs: /// <summary> /// gets actual page index /// </summary> public int PageIndex { get { return _pageIndex; ...

How to get the page calling the usercontrol

I have a user control .Is there some way to get the page in which usercontrol is available ? ...

FindControl for nested controls in UserControl returns null

Hi everyone, I have a very weird issue. I have a UserControl that has some controls inside. I want to refer those controls after, in another postback. But when I try to get them the Controls property of my controls returns null. I'm working on vs2008. Here is the sample code: public partial class MyUserControl : System.Web.UI.UserCont...

Nested UserControl Render Order

Hi everyone. I have a custom control created in codebehind, and I have in the same control an ordinary asp.net button. Like this: protected void Page_Load(object sender, EventArgs e) { } private void MyTable() { Table table = new Table(); TableRow row = new TableRow(); TableCell cell = ...

VS 2010 - Error when opening User Control / Form with Designer

C#, VS2010, WinForm application: Sometimes I do have the problem that I get an error message when opening some of my controls / forms. All code compiles and the application runs properly. Opening the control in the designer gives me: The designer loader did not provide a root component but has not indicated why. From my experien...

Silverlight Togglebutton Set IsPressed state

Hello I have a Toggle button in Silverlight. I want to set its state to "pressed". First I tried : btButton.IsPressed = true But that does not work (readonly). Then I tried : btButton.SetValue(ToggleButton.IsPressedProperty, true); Which also does not work. How do I accomplish this ? I'd assume it would not be that hard... ...