custom-controls

What is the best VB.NET control (standard/custom) for displaying list of files?

I'm developing a Desktop Search Engine in VB.NET and I'm looking for a powerful, flexible and feature-rich control for displaying the search results i.e. list of files. ...

Are Margin and Padding implemented by ContentControl?

Hi, I am developing a custom control derived from System.Windows.Controls.ContentControl. In the controls default template (themes\generic.xaml), I use a Border element that wraps the actual content. Does my custom control already implement margin and padding (i.e., shrink the border according to the padding set on the custom control) ...

DataSource for User Control

I am buidling a user control. Currently it consists of a textbox and a button - as a learning experience. This will be used as a basis for a more useful control. I want to add a DataSource, display member and ValueMember. Here is my code for the datasource. It will display in the Properties editor, but is disabled and grayed out. Wha...

Testing Custom Control derived from ComboBox

I've created a control derived from ComboBox, and wish to unit test its behaviour. However, it appears to be behaving differently in my unit test to how it behaves in the real application. In the real application, the Combobox.DataSource property and the .Items sync up - in other words when I change the Combobox.DataSource the .Items l...

Error rendering control cache is not available

I have a custom control that shows a value obtained from the database (the price of the product). This value is stored in the cache for performance reasons and it works fine. However, in design mode in Visual Studio 2008, I get an error that says, "Error Rendering Control. An unhandled exception has occurred. Cache is not available" I'm...

Subclass built-in WinForms control?

I've come across the feature in Visual studio to auto-generate a subclass of a custom control using Add New Inherited User Control. But I haven't found a clear description on how to e.g create a subclass of Button for instance. Apart from the actual way to do it, I'm also interested if VS provides helpful code-generation for this? ...

How do I build Web User Controls that are configurable ?

So here is a project outline, I need to make a web application with its core components encapsulated in Web User Controls. The reason for this is that the company will be using MOSS extensively by early next year, and we want to use these components later on as web parts. I think these web user controls will need to be flexible in terms ...

Relative percentage UI control

I need the user to set a number of percentage values which should always add up to 100%. What are standard ways to archieve this? I came up with the following: 1) have a standard slider control for each value you need to set. Moving one slider will automatically adjust all the others so the sum will always come out as 100%. You can fix ...

Custom TextBox Control And Validation Display

Hi, I have created a custom TextBox control which also contains a RequiredFieldValidator. Everything works fine but the problem is in display. The display is something like this: [TextBox Control] [Validation Error Message] I want the display to be something like this: [Validation Error Messsage] [TextBox Control] (the validati...

Why is Me.components Nothing?

I have written a custom ErrorProvider which adds some functionality to the existing ErrorProvider (sets control BackColor, ErrorCount etc). This was working find but now for some reason it falls over on the constructor: _LoginErrorProvider = New ErrorLogErrorProvider(Me.components) The error is a NullReferenceException which is caused...

ASP.NET: generate property value when adding control to page

Context: ASP.NET 3.5 / C# Hi, I created a user control public partial class MyControl : UserControl { // EDIT: example first used "UniqueId" as property name, which was wrong. public Guid MyId { get; set; } // ... } and this example usage <uc1:MyControl ID="myControl" MyId="443CBF34-F75F-11DD-BE2F-68C555D89123...

How do I make custom controls in Silverlight?

I've created a custom control using Expression Blend: <UserControl xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" ...

Embed Resource a SWF Flash video Player in ASP?

I am trying to do an ASP.net custom control for the Flow Player flv player that has the swf object embedded. With Steve Orr Controls I learned that you can embed javascript files and register them so you don't have to always add the javascript files manually. I am wondering if this holds true to SWF files. I have been reading all over t...

How to restyle a control nested in a custom control?

Suppose that you are developing a custom control in WPF that contains internally some other basic controls. To keep it simple suppose that it contains 2 buttons. Now you want to use this custom control in your app, but you want to restyle it a bit. CASE 1 If, in the custom control definition, both buttons have the same style (wpf defa...

Why shouldn't you use a handle during component creation or streaming?

I want to make a custom VCL control that wraps a SDL rendering surface via the SDL_CreateWindowFrom function. SDL_CreateWindowFrom takes an existing HWND handle and puts a high-performance rendering context (it has several backends available, including DirectX and OpenGL) onto it. The helpfile says "Do not refer to the Handle property ...

What would you say to someone who wants to make everything a .NET control?

For example, we have some CSS rules to define our form layout. We use the following markup: <div class="foo"> <label class="bar req">Name<em>*</em></label> <span> <asp:TextBox runat="server"/> <label>First</label> </span> <span> <asp:TextBox runat="server"/> <label>Last</label> </sp...

Custom ASP.NET control inherited from the GridView control is not rendering style(s) (e.g. AlternatingRowStyle.BackColor)

I'm having a bit of an unusual problem with an extended version of the ASP.NET GridView control that I am working. It is rendering all of the text applied to it just fine, but is not rendering any the style properties that are set. For example, if I set the AlternatingRowStyle to use a gray background, the gray background is not being re...

WinForms: How to custom draw using the selected RenderMode?

I have some custom controls that will require custom painting. I cannot use any of the drawing services available in Windows (e.g. ThemeAPI), since .NET applications ignore look-and-feel of the operating system they are on, and instead use their own look and feel. e.g. Toolbars are not the toolbar common control Status bars are not t...

Custom Control and Visual Studio 2008 SP1

I've created a custom control (a class that inherits from Control). When I put it on a Form I can work with it on Visual Studio IDE. It shows me an error and I don't see the form. The error message is this: La variable 'ctrlImagen' no está declarada o no se asignó nunca. It's a winform for a Compact Framework app. How can I solve this...

Custom Control to show an Image: move the image inside

Hi! I'm developing and C# app for Windows Mobile. I have a custom control with OnPaint overrided to draw an image that the user moves with the pointer. My own OnPaint method is this: protected override void OnPaint(PaintEventArgs e) { Graphics gxOff; //Offscreen graphics Brush backBrush; if (m_bmpOffscreen == null) //Bit...