usercontrols

[C#] Creating my own component with DataSource and DataBind()

Hi, I want to do my component that works similar to most of data controls (MS, Telerek, etc.): myControl.DataSource = new List<myClass>(); mycontrol.NameField = "Name"; myControl.ValueField = "Value"; myControl.DataBind; I have some test code: class myClass { public String Name { get { return _name; } } ... } class c...

Parent get focus when child control requested it

Hi, I have a WPF UserControl (B) as a child of another UserControl (A). I have a situation where in some instances B requests focus but A actually gets the focus. Does anyone have any idea why this might be happening? Code in B to get the focus: log.Debug("Asked for focus."); //We expect the user to do a button press and therefore ne...

How to design a wpf dependeny Property to support the path to image ?

To describe my problem i have created a small application. At first the Usercontrol: <UserControl x:Class="WpfApplication10.UserControl1" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" x:Name="This" DataContext="{Binding ElementName=This}" > ...

Passing parameters to a User Control

We are trying here to localize our user control basically we want to be able to do something like this : <in:Banner runat="server" ID="banners" Lang="fr" /> The way we do this is by page level and send it to master that then send it to the control: protected void Page_Load(object sender, EventArgs e) { Master.Lang = "FR"; } Th...

WPF MVVM User Control binding issues

I have an application that uses MVVM. I have several items on the main window that bind to the ViewModel for that window. When I run it everything works. However, when I add a user control to the main window and try to bind to one of its dependency objects it throws an exception (“Object reference not set to an instance of an object”). T...

Windows Mobile Gradient Fill Button - UserControl vs Subclassing Button

Hi, I've started looking at Windows Mobile development and I'm struggling to make a pleasing UI using the default controls (they really are ugly). I've looked at a handful of UI 'frameworks' and they are either costly or complex (my needs are simple). So I've decided to write my own controls. Taking a rounded rectangle gradient filled ...

ASP.NET - user-controls repeater

Hi All, I am building a Web Application for shopping cart using ASP.NET and I am new to ASP.NET. One of my close associate suggested me to use the user controls, repeater and master page for faster development of pages. Can you suggest me reading materials to quickly grasp its usage. Thanks to All. Regards, Justin Samuel. ...

ASP.NET: How do I implement my own AssociatedControlID-like functionality?

I have two user controls A and B, where B depends on the existence of A in the same page. I'm trying to implement some functionality like this: <mine:A ID="IdOfTheAControl" runat="server" /> <mine:B BelongsTo="IdOfTheAControl" runat="server" /> I'm able to extract "IdOfTheAControl" but unable to get the actual control with that ID. I...

How do I embed a user control in a DLL?

How can I embed a user control in a DLL? Ideally, I would still be able to define the control's markup in an ascx file, but if I understand correctly you cannot embed template files into DLLs. ...

Templated user control question - Collection of multiple object types

I am planning on creating a templated user control to allow for the following markup. <myCustomControl id="myCustomControl" runat="server"> <testObjects> <addPredefinedObject name="test1" /> <addPredefinedObject name="test2" /> <addCustomObject id="1" /> <addPredefinedObject name="test3" /> <addCustomObjec...

DataBinding of a UserControl via ControlTemplate

Hello, I'm playing around with the Infragistics xamDataGrid. I'd like to display in a "Field" (= Cell) a custom UserControl and have for it the Field's DataContext. Somehow the DataContext is always null :-) Here is the XAML: <UserControl.Resources> <Style x:Key="MyTestUserControl" TargetType="{x:Type igDP:CellValuePresenter}"> ...

ASP.NET 2.0 C#- How do I perform an action on a gridview column only if it exists?

I have a gridview which is in a usercontrol on a page. The gridview displays data based on whatever the calling page tells it to, which may or may not include certain columns. I want to tell the gridview how to format the columns if they're present on the page, but I also need it to ignore all the formatting if the column doesn't exist...

SharePoint user control deployment issue

Hello everyone, I am using SharePoint 2007 Enterprise with Windows Server 2008. I am using VSTS 2008 + C# + .Net 3.5. I am new to SharePoint user control development and deployment. I am learning from, http://www.codeproject.com/KB/sharepoint/PageFooter.aspx But confused about the following deployment steps, my question is in what fil...

asp.net passing string variable to a user control

Hi all, I am trying to pass value of a code behind variable to a user control like: <pv1:ShowPdf ID="ShowPdf2" runat="server" BorderStyle="Inset" BorderWidth="2px" FilePath='<%=path2%>' Height="700px" Width="856px" /> where path2 is a protected string variable declared in code behind. The problem is that the value of path2 ...

Use an installer to add .NET User Control to Visual Studio Toolbox

Hello, I am creating a .NET user control that I will be distributing using a commercial Installer. How do I automatically add the user control to the Visual Studio Toolbox when my installer runs ? Thanks ...

Unwanted caching of usercontrols and masterpages forcing iisreset

My setup is a standard Windows 7, Visual studio 2008 and IIS 7.5 and I suffer from unwanted caching of usercontrols and masterpage files. Often but not always when I make changes in a usercontrol in Visual studio I have to reset the IIS to be able to see the changes I made in the HTML. I have also experienced this problem with IIS 6 and ...

Bind Winform control property to a property on User Control using INotifyPropertyChanged

Hi there! Please advise me. Winforms app, C#. I have a user control (UC) that contains a DataGridView. Firstly, I have a boolean public property in the UC called "IsComplete". in the RowEnter event of my DGV, Im able to set the property accordingly. Secondly, I successfully instantiate and load this UC into its designated area in ...

Runtime implementation or static user controls

A few of my silverlight pages should provide a custom error message depending on whether an error occurred and what the error is. I have a custom control that will present the user with the error, however, my question is: Would it be better to add this control into the XAML and just set it as collapsed or visible (depending on whether a...

ASP.NET 2.0 C#- A couple issues with a GridView inside a UserControl

I have an asp.net page with a custom usercontrol which contains a selectable gridview, and a formview which is on the page directly. First issue: I want the FormView's pageindex to be the selected index of the GridView. I can get the selectedindex of the GridView by doing this: public virtual int SelectedIndex { get { retu...

WPF Layout of user control as a run

Hi In WPF, I want to create a Window that looks like the following: On the screen are four user control, #1, 2, 3, 4. As you can see, user control 2 should not be rendered as a box, but inlined. If this were a WPF flow document: 1, 3, 4 would be a paragraph (boxing) 2 a run (inlining) The reason is that 2 could be used i...