custom-controls

How can I handle events within my custom control?

I am not looking to create new events. I need to create a canvas control that optionally fades in or out depending on whether or not the mouse is over it. The code below probably explains what I want to do better than I can. private Storyboard fadeInStoryboard; private Storyboard fadeOutStoryboard; public FadingOptionPan...

Newbie question: Creating a custom control

Hi, I have an ASP.Net site, in which I am using a ListView with a Datapager. Apparently there is a bug with the Datapager, where it crashes if there is an empty ampersand (&) in the querystring. This is a known issue: https://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=357344&wa=wsignin1.0#tabs I see th...

Create controls from code - VB.NET

Hello everyone, I want to know if I can create a WebBrowser through code in Vb.NET, instead of dragging a webbrowser into the form. Simple enough to say, I would greatly appreciate your help. ...

Haw can i use a value from a session variable within the attribute of a control?

I have an ASP control custom built and I need to pass a value taken from a session variable to it like so: <custom:control id='mycontrol' value="+Session['myControlValue']+"> ... </custom:control> the above code obviously doesn't work, I need a way to insert the Session value in the control in this way somehow, can anyone help? ...

How to prevent Visual Studio setting my default font sizes in an inherited control

I have a base class for all my textboxes and I want to set the default font in that class. So I started with this: public partial class MyTextBox : TextBox { public WmlTextBox() { InitializeComponent(); //Font for the whole application can be altered in the Appearance class Font = new Appearance().TextBoxFo...

Avoid painting over nested controls

I am writing a toolbar-style control and use the ThemeServices unit to paint the background required by the toolbar. Like so: ThemeServices.DrawElement(Canvas.Handle, ThemeServices.GetElementDetails(trRebarRoot), ARect); I then drop child controls onto the toolbar and voila - instant toolbar. Except that every now and again I notic...

Custom Silverlight button with <Path> content and visual states

I would like to create a button control that has a Path element as its content--an IconButton if you will. This button should fulfill two conditions: 1. The Path element's stroke and fill colors should be available for manipulation by the VisualStateManager. 2. The Path element's data string (which defines it's shape) can be set i...

WPF Style Override breaks Validation Error event propagation

I have a custom control that overrides Window: public class Window : System.Windows.Window { static Window() { DefaultStyleKeyProperty.OverrideMetadata(typeof(Window), new System.Windows.FrameworkPropertyMetadata(typeof(Window))); } ... } It also has a style: <Style TargetType="{x:Type ...

Multiple Control Templates for a custom control in Silverlight

I am creating a custom control. The contents of the control will differ a lot when in different visual states. Can I to achieve the above, apply different control templates to the same custom control? That is define more than one control template for a custom control? If not, any clues as to how I can do this, without have as many cust...

Which Java Framework is best suited for a web application with reusable content/behavior

I come from a .NET background and need to do a web project in Java. I have read a bit on all the different Java web frameworks out there: JSF, Stripes, Wicket, Tapestry etc. But I would like to hear from people with real-life expertise with these frameworks. Of course I want a framework that is up to date, supports AJAX, is cool and s...

What is a good way to factor out and simplify a complicated WPF custom control?

I am looking for a good way to simplify and organise a complicated WPF custom control. My first thought is to factor it out into two simpler controls. For the sake of explanation I'll call these SimpleControl and AdvancedControl. SimpleControl contains all the core functionality and is extremely reusable. AdvancedControl depends u...

How to force a TextChanged event on a WPF TextBox and mantain the focus?

I am creating a numeric TextBox in WPF, with two buttons to increase and decrease the value. I have create two RoutedCommand to manage the behiavor and they are working well. There is only one problem that I would like to solve. I would like that the control notifies all object binded to its TextProperty when an increase or decrease com...

Custom Control Not Playing Nice With PropertyGrid

I have a class that is implementing a custom ToolStripItem. Everything seems to work great until I try to add the item to a ContextMenuStrip at design time. If I try to add my custom control straight from the ContextMenuStrip the PropertyGrid freezes up and will not let me modify my Checked or Text properties. But if I go into the Con...

Subcontrols not visible in custom control derived from another control

I'm trying to create a custom control by deriving from a ZedGraphControl I need to add a ProgressBar to the control, but I encountered some problems. When I create a custom control and add both, ZedGraphCOntrol and ProgressBar to it, everything is OK: MyCustomControl { ZedGraphControl ProgressBar } All elemnets are visible a...

BlackBerry - Custom centered cyclic HorizontalFieldManager

Trying to create a custom cyclical horizontal manager which will work as follows. It will control several field buttons where the buttons will always be positioned so that the focused button will be in the middle of the screen. As it is a cyclical manager once the focus moves to the right or left button, it will move to the center of the...

RadioButton not checked when posted

I have created a custom RadioButton control, because I needed to set additional values in to it. But regardless of whether the UI shows the control as checked or not the control does not have a True property for checked. The outer repeater iterates through Qualifications, which contain a List of Subjects. The subjects are iterated throu...

Winform custom control in WPF

Hi, I'm inserting a custom winform control in a WPF/ XAML window, however i'm realising that the sizing seems to be very different, what i designed in winform to be 730pixels wide for instance, when placed via a WindowsFormsHost, in a container 730pixels (or at least i think they're pixels..) wide, the control looks much larger and doesn...

How to give a custom ASP.NET control the ability to parse XML markup to a collection?

I'm writing a custom ASP.NET webcontrol and would like it to have a collection of custom items which can also be specified in the XML markup. Something like this: class MyControl: WebControl { public IList<MyItemType> MyItems { get; private set; } } And in the markup: <asd:MyControl runat="server" id="mc1"> <MyItems> ...

Cocoa nextEventMatchingMask not receiving NSMouseMoved event

Hello, I created a local event loop and showed up a borderless window (derived from NSPanel), I found in the event loop there's no NSMouseMoved event received, although I can receive Mouse button down/up events. What should I do to get the NSMouseMoved events? I found making the float window as key window can receive the NSMouseMoved...

Good Silverlight Custom ItemsControl Tutorial

I'm afraid my Google-Foo is failing me again today. I'm trying to find a good tutorial on creating custom ItemsControls in Silverlight (though I imgaine a WPF version might work as well). I'm trying to create a custom ItemsControl that will be something of a virtualized ListBox. What I'm trying to accomplish isn't really similar enoug...