usercontrols

How to pass information from one WPF UserControl to another WPF UserControl?

I've got a WPF application. On the left side there is a stackpanel full of buttons. On the right side there is an empty dockpanel. When user clicks a button, it loads the corresponding UserControl (View) into the dockpanel: private void btnGeneralClick(object sender, System.Windows.RoutedEventArgs e) { PanelMainContent.Children.C...

VB6.0 : initialize method of a User Control called when loading a VB project.

Whenever we load a VB project it will call initialize method of a User Control ( if there is any in the project). My problem is that is that I have some code in UserControl.initialize that will try to create instances of other COM objects. And on my build machine those controls are not registered. One option is to move the code to some o...

Upper (reasonable) limit to number of user control instances

I have a menu that used to be a treeview control but now I want to make each item a bit more visual and add some more information to each object in the tree. My first intention was to make a user control that represents an item and add them to a panel at runtime. Is this a good aproach? There could sometimes be over one hundred items. I...

$(document).ready in ascx page after ajax callback

I'm having a little problem with this setup here I have a list of .ascx files and they all do different tasks in terms of calculations to the controller itself. So on my .aspx page I click on an Ajax.ActionLink() and this will render that specific .ascx file based on the item I clicked. Within that .ascx are 1-3 events that will fire 2 o...

free pdf viewer user control

Does anyone know of any (preferably free, but if not, that's fine as well) user controls that will display a pdf documents similar to the PrintPreviewControl? I'm trying to make a document viewer that will show the document and have MenuBar buttons for e-mailing/faxing/printing/etc. the document in question. Right now, it works complet...

LinkButton in nested UserControls not firing Command event

I have a nested UserControl (this control is dynamicall loaded by another UserControl that is dynamically loaded by an aspx page inside a MasterPage) in which I would like to use a LinkButton and the OnCommand Event. This button must be added to some panel, so I hooked up to the OnLoad event of the panel (it needs to be created before e...

What is the best way to implement the graphics for a selected item in a WPF user control?

I have implemented a few different WPF user controls. In doing so I have also implemented a few different ways of implementing the graphics for when an item is selected. I want to find out how others are doing this and what they think is the best way of doing it? Only one solution per answer please. To avoid confusion here are some...

User Control with multiple events has asynchronous postback on event not specified in an UpdatePanel

I have a user control which has two events. A button Click and a drop down list SelectedIndexChanged. Also on the same page there is an UpdatePanel, which has an AsyncPostBackTrigger that is conditional on only one of these events; however, an asynchronous postback occurs when either of the events in the user control occur. Is there a...

referencing appSettings from usercontrols

In my .ascx usercontrol i'm trying to dynamically generate links using a value i've stored in web.config. <a href="<%$appSettings.MYPATH%>/file.aspx">link</a> and when i try running, i get a parser error Literal expressions like '<%$appSettings.MYPATH %>' are not allowed. Use <asp:Literal runat="server" Text="<%$appSettings.MYPATH%>...

WPF access info from the containing Control

I have a UserControl(a) with a stackpanel which has its ItemSource set to a collection. The StackPanel then contains a set of UserControl(b) that contain a few buttons and a datagrid control. Is there a way from the code behind in the UserControl(b) to access properties in the code behind of the parent UserControl(a). Basically when Us...

Javascript image change causes embeded UserControls to flicker

I have a n html page being displayed in IE. It has some buttons made up of images with mouseover/mouseout events on them in JavaScript, and a bunch of embedded .Net UserControls. When the mouseover/mouseout events fire, I change the images src to something else (simple rollover effect). The problem is that the UserControls often (but ...

What is the difference between loading Pages or UserControls into a XAML Frame Element?

I'm rebuilding a WPF slide-show application structure that I found in the downloadable code for this WPF video. There is a Presentation class which has an INotifyPropertyChanged property "CurrentSlide" which changes as you click next/previous buttons and is displayed dynamically in a Frame element. The downloaded code loads Pages into...

ASP.NET Add Control on postback

Hi, I've put together a simple form to highlight the concepts of dynamic forms. What I need to do is add a control to the page when the user clicks the "Add" button. I have a simple counter at the moment that stores the amount of controls created, which is incremented when the button is clicked. At first I thought it would be as simp...

Fuzzy Date Time Picker Control in C# .NET ?

I am implementing a Fuzzy Date control in C# for a winforms application. The Fuzzy Date should be able to take fuzzy values like Last June 2 Hours ago 2 Months ago Last week Yesterday Last year and the like Are there any sample implementations of "Fuzzy" Date Time Pickers? Any ideas to implement such a control would be appreciat...

What is the best way to not have DependencyProperties conflict with actual properties?

I find that when I make Dependency Properties, most of them conflict with names of properties in the UserControl, e.g Background, Width, etc. so my strategy is to prefix all of my custom properties with "The" so I have, e.g. TheBackground TheWidth etc. I tried using the "new" keyword which gets rid of the warning, but that leads to ...

Create a custom click event handler for a WPF usercontrol which contains a button?

Hello guys have you ever found a problem when assigning a click event handler for your custom WPF usercontrol with a nested button control? I do. When you put such user control in a main window, let's say Main.xaml, the MouseLeftButtonDown doesn't work, but the PreviewMouseLeftButtonDown works like a charm. But imagine yourself tellin...

When a user control has Browsable false on public property, why does designer set it to null when added to a form?

I have a user control that has a few public properties, one is an object where I set [Browseable(false)]. When I add this control in Visual Studio's designer the generated code sets this object to null. public class Foo : System.Windows.Forms.UserControl { [Browsable(false)] public object Bar { get; set; } [Browsable(true)]...

Adding a list of UserControls with buttons to a PlaceHolder - no event?

I want to make use of "complex" usercontrols with more than one control element within. Its the same control I will reuse in the list and I have a PlaceHolder control for it already. I can add the control with LoadControl(path to .ascx) - no problem. I can thru my custom properties get/set access the embedded Labels too, so I can initi...

asp:Literal control null in user control

I've a user control which contains asp:Literal. <div> <asp:Literal id="MenuContainer" runat="server" /> </div> There is a method in code-behind page which initializes the control: internal void Setup(MyBusinessObject obj) { MenuObject menu = MenuHelper.GetMenu(obj.State); if(obj == null) MenuContainer.Visible =...

Generic ComboBox with automatically named properties

I'm writing a wrapper for the WinForms ComboBox control that will let me populate the dropdown with a List<T>, and has a Selected property that returns an item of type T (or null if nothing selected). Rather than having a Selected property, I'd like it to be named based on the generic type automatically. For example: MyDropDownList<Us...