usercontrols

WPF UserControl Style

I want to set the background property of all the usercontrols of my project. I tried with <style TargetType={x:Type UserControl}> <setter property="Background" Value="Red" /> </style> It compiles but didn't work. ¿Any Idea? Thanks! ...

Usercontrol access javascript from a Content's Page's Master Page

Hello all I have a problem. I have a masterpage that all of my Content pages inherit from. Within this masterpage I have a script tag pointing to the javascript file folder "~/Scripts/validation.js" On my content pages I use different usercontrols that require the use of many of the functions within the validation.js file however if I d...

WPF: Make Whole Border Clickable

I'm trying to implement a button in WPF which shows a menu when you click it. I've got everything working, and the ControlTemplate for the control is shown below. (The control extends ToggleButton). <Border x:Name="Border" Padding="3" CornerRadius="1" BorderThickness="1" VerticalAlignment="Stretch" HorizontalAlignment="Stretch" IsHi...

VS2008.NET: Getting a referenced project's dependencies to copy to main project's bin folder

Let's assume I have a C# Winforms project, MainGUI. It references another project in the same solution, ControlsLib. ControlsLib references a third party control suite, such as Infragistics or Telerik controls, and exposes a set of user controls, that are used in MainGUI. Copy Local is set to true on all the references in ControlsLib,...

Populate user control on event raised by another user control in the same page.

In a webpart I have two user controls loaded. I want to be able to populate one of the controls when an event is triggered in the other control, a parameter has to be passed between the controls. ...

ASP.Net, Drag-n-Drop, Postbacks, and Control IDs

The title attempts to summarize the problem, but here's a more detailed summary: our web page is a collection of usercontrols, which visually render as rectangular reporting widgets, which are set in AJAX updatepanels. We are giving the user the ability to drag and drop the widgets to pre-set "zones" on the page. The drag and drop fu...

How (if at all) can you make an ASP.NET UserControl inherit from another UserControl?

In Windows Forms it's easy to inherit one user control from another. The inherited control contains all the controls of the parent form, and you can add some more. Can the same be done with ASP.NET? I'm talking about the .ASCX type of user controls. ...

What's the best way to keep dynamic user controls around in a page?

I have an app that currently uses a bunch of include directives of aspx files, a lot like a classic ASP app might work. (I know, ugh.) I would really love to convert this to dynamic user controls since the URL/querystring will help determine what code should execute. I know that I'll need to dynamically load user controls before the P...

WPF: Limiting Valid Control Part for Dragging Operation via DependencyObject

I'm asking this question after reading this answer on StackOverflow. The supplied answer works great for allow you to move a whole control. But supposed I have a Usercontrol I've created like so: <UserControl x:Class="WpfTest.UserControl1" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schem...

How to make usercontrol available to multiple projects?

I have a set of UserControls in a ASP.NET website that I would like to share to multiple website. But it seems we are unable to create a class library with UserControls in it with the ascx file. While MSDN suggest building a Web Control, I Would rather find a way to share the existent controls instead of destroying them to create new web...

WPF Can Text be Overlayed/Underlayed with a Thumb?

I've got a WPF UserControl that works as a floating "chat window" for an application I'm writing. Basically, three rows in a grid: header, richtextbox for the chat messages, and finally a textbox for user input. The header element has a Thumb on it so that the user can drag the chat window around inside the application. But I also need...

What is the most efficient way for a control to determine if it's rendering in a Web form or a master page?

I have a control that can be placed in a Web form (.aspx) or a Master Page (.master). I want it to function differently depending on which one it's in. My first thought is to climb the control tree back to the root and see if I cross over a MasterPage control. If so, then it would have to be in the Master Page. But, this seems ineffi...

How do you pass a another control into a user-created ASP.NET control as a parameter in its decleration using the ID of the other control?

I'm trying to create a control (MyControl) which does things to other controls on the page it's on. It has a property: public property System.Web.UI.Control SomeOtherControl; I want to be able to set this property from the ASPX page that uses the control. Right now, the only way I can do it is in the Page_Load of the code-behind: MyC...

Attach ICommand in WPF UserControl

Hi everyone, I implemented a simple button with an image in it: <Button Command="{Binding ButtonCommand, ElementName=ImageButtonControl}"> <StackPanel Orientation="Horizontal"> <Image Source="{Binding ButtonImage, ElementName=ImageButtonControl}"/> <TextBlock Text="{Binding ButtonText, ElementName=...

.Net UserControl - Docking 2 controls

Let say I have 2 controls in a usercontrol : One (controlA) that have a fixed height and need to be dock in the bottom and an other (controlB) in the top that must fill the leaving space. If I use bottom dock for controlA and fill dock for controlB it's doesn't work because controlA goes over controlB ... How can I do this correctly, ...

DNN 5 - Can't get current ModuleId from nested user control in cutom module

I'm writing a custom module for DNN 5, and I need a "Manage" link to be on every control in the module. I created a new UserControl ("ManagerLink") that inherits from PortalModuleBase, put my link into that control, and dropped that control on ALL OF MY MAIN CONTROLS. The problem is that ModuleId and TabId are always -1 in "ManagerLink"...

AJAX ScriptManager in UserControl

I have a UserControl that contains an UpdatePanel which wraps some other controls. The UserControl will be used on some pages that already have a ScriptManager and other pages that do not have a ScriptManager. I'd like the UserControl to automatically bring its own ScriptManager if one does not exist. I have tried ScriptManager.GetCurre...

Flow of control in ASP.NET form

HI, I am trying to develop a form which has some user controls , which are basically dropdownlists which will be loaded with static list of pick-list values, and a master page. I have written code in the page behind to bind values to the non pick-list fields. I find that the flow of the control is like this at runtime :- 1) First th...

Where should I store configuration data for custom-controls (user-controls) ?

I'm writing a custom control and I would like to include some configuration options for the control, but I'm not sure where I should put them. I could probably put them in the the web.config of the application where I'm using the control, but that seems a bit messy to me. What should I be doing? EDIT: The configuration data will typi...

WPF - Can I stop UserControl exposing its named child elements?

This is a bit of a noob question but I've just realised that if i create a UserControl and choose to name some of its child elements a la - <UserControl x:Class="UserControls.uControl" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Height="300" Width="300"> <Grid...