custom-controls

ASP.NET custom control: when is LoadPostData() called?

Hi all I have developed a custom control that extends ListBox. The idea is that the control 'remembers' modifications to its elements which occurred client-side, e.g. as a result of an AJAX request. The way it works is that the control also renders a hidden input, and the result of the AJAX request is stored in the hidden input. This ...

Custom control binding to a collection within a property

HI, I stuggeling with the databinding with in a custom control I've got some properties within my custom control. public static DependencyProperty TitleProperty; public static DependencyProperty PageDictionaryProperty; public string Title { get { return (string)base.GetValue(TitleProperty);...

Adding event to custom control in ASP.NET

I am extending the TextBox class to include CustomValidator along with the TextBox. I have created properties like CSSClass for ErrorMessage, CustomErrormessage for ErrorMessage on failure. But I am not sure how to get server side validation method in the form of tag. Example: <asp:CustomValidator runat="server" id="custPrimeCheck" ...

Error in custom control when using INamingContainer interface

Hello All: I am creating a custom control to extend textbox to include validations. Following in the code: public class EncodedTextBox:TextBox { /// <summary> /// /// </summary> private RequiredFieldValidator rqvVldrText; /// <summary> /// /// </summary> private R...

How to create wpf custom Button without building style xaml ?

When building custom control, I found that the custom control did not inherit the style from base class (say Button). Is there a simple ways by hardcode without building another style resources ? ...

conditional javascript in .ascx

I have a javascript src that i need to add to some of the pages in a site. for example <script type="text/javascript" src="http:abcxyz.com/zzz"></script> I want to add this conditionally on a .ascx page - if the Request.ServerVariables["SCRIPT_NAME"] ends with certain criteria. The ascx language is vb, and there is no code behind. T...

listbox containing Custom Controls?

Is it possible to make a listbox that lists a bunch of custom controls? I would assume that you might have to invoke some sort of custom drawing of the child objects, but I do not know how to do that. Can anyone shed some light on this? ...

Getting correct sizing behaviour in a custom Swing component

I'm creating a custom Swing component that inherits from JPanel. What is the right way to override/implement the various sizing methods (getPreferredSize, setPreferredSize, getMinimumSize etc.) in order to get "good behaviour", particularly with regards to: Working with different layout managers Behaving correctly when setPreferredSiz...

Control.Parent = null

I have my own control derived from Windows.Forms.Control and I am checking the Parent.BackColor inside the overrided of OnHandleCreated() method. At desing-time the Parent property first returns null, then - after form is completely loaded - returns the real parent window: the form itself. We need to draw part of the custom control with...

How do I make an custom drawn resizable container?

I have a WinForms gui application which has a number of areas to it which I'd like to custom-draw some graphics. These areas would contain controls and be resizeable. I'm currently thinking of inheriting from a TableLayoutPanel and handling onpaint messages. Does this sound like a good way to go or are there other/better options? ...

wxPython: Can a wx.PyControl contain a wx.Sizer?

Can a wx.PyControl contain a wx.Sizer? Note that what I am ultimately trying to do here (spinner with float values) is already answered in another question. I am particularly interested in layouting widgets within a wx.PyControl, a skill which might prove useful if I come across a need to make my own custom widgets. I already read throu...

Wrapping msctls_hotkey32 in .NET Windows Forms

Hi all. I'm trying to get a hotkey control working in C# based on both the Control class and the msctls_hotkey32 win32 class. What I have works, though it's not perfect: class Hotkey : TextBox { protected override CreateParams CreateParams { get { CreateParams parms = base....

Custom nested container control

I'm writing a custom control which consists of a FlowLayoutPanel nested in a normal Panel. The FlowLayoutPanel is internal to the class, and shouldn't be able to be viewed by the designer (unlike a Tab, which has its individual properties exposed.) Any control the designer adds to the Panel should instead be added to the FlowLayoutPanel....

Click event handler with Custom Control Button

I'm creating an ASP.NET Custom Control for my web application which is basically an ASP.NET Button control contained inside multiple <div> elements (for styling purposes). How can I create a Click event handler for my custom control so that my control acts as an ASP.NET Button? Ie. <cc:Button id="myButton" runat="server" Text="Submit"...

Putting IME in a custom text box, derived from Control

I have created my own single-line textbox control in C# .net 3.5 I've written this completely from scratch, including my own selection code, scrolling, copy/paste etc. It can even select left-to-right text, not that I'd ever use that... The problem I'm having is with IME (input method editor) integration. The IME does work to an extent...

How to dynamically add user controls within a user control.

I want to create a user control that will again contain a user control that will be dynamically generated and can be repeated N times with respect to data present in data table. How can i do this. ...

Arrow key events not arriving

Test project which exhibits the problem: http://mike-caron.com/Testbed.zip Basically, I have a form with a custom control on it (and nothing else). The custom control is completely empty, and the form has KeyPreview set to true. With this setup, I am not receiving any KeyDown events for any arrow keys or Tab. Every other key that I hav...

wxPython: wx.PyControl layout problem when it is a child of a wx.Panel

This is a continuation from this question: wxPython: Can a wx.PyControl contain a wx.Sizer? The main topic here is using a wx.Sizer inside a wx.PyControl. I had problems Fit()ting my CustomWidget around its child widgets. That problem was solved by calling Layout() after Fit(). However, as far as I have experienced, the solution only w...

How to bind to a custom property in a Silverlight Custom control

I've created a custom control with, amongst others, the following: public partial class MyButton : UserControl { public bool Enabled { get { return (bool)GetValue(EnabledProperty); } set { SetValue(EnabledProperty, value); SomeOtherStuff(); } } } public static readonly DependencyProperty EnabledP...

All controls are still null after calling EnsureChildControls() ?

The way this page is laid out, all of the data is loaded at Page_Init. Well, I have a custom control that is having problems with this though. I have it on the page like so: <cc:SomeControl... /> And then I set the value at Page_Init using MyControl.Value="blah"; Simple stuff.. The Value is an accessor and has something simila...