custom-controls

How to distinguish Mouse.Clicks from different part of a control

If I have a Control with template like this: <Style x:Key="HomeButtonStyle" TargetType="{x:Type Control}" > <Setter Property="Template"> <Setter.Value> <ControlTemplate> <StackPanel VerticalAlignment="Top"> <Rectangle Width="20" Height="50" x:Name="PART_Rectangle" /> ...

JSF 2.0 custom components with XSLT

Is it possible to write own JSF 2.0 components with help of XSLT? ...

How can I bind to dependency properties of a custom control from a resource dictionary defined in Generic.xaml?

EDIT: I rephrased the entire question. Hello everybody, I have a custom control with dependency properties. In the Generic.xaml file I have a resource dictionary. It's a resource dictionary within the outer dictionary, defined like so: <ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http...

Why can I no longer bind GradientStop Color to a Dependency Property of my control?

The summary of my problem: I had created a UserControl where I bound my dependency property "Scheme" to the Color property of a GradientStop, and it worked perfectly. Now, after converting my UserControl to a custom control, this binding no longer works, and I don't know why. EDIT: Replication of Custom Control Problem: http://www.mega...

Create a custom control?

Hello, I have this HTML code: <select id="dummy4" name="dummy4" class="myselectbox"> <option>....</option> <optgroup label="Agent1"> <option>Subagent1.1</option> <option>Subagent1.2</option> <option>Subagent1.3</option> <option>Subagent1.N</option> </optgroup> <optgroup label="Agent2"> <option>Subagent2.1</option...

VS 2008 unable to find user controls in .NET Compact Framework application

When I open the form in the application, I am seeing an error for each user control in the project. Warning 13 The variable 'usercontrol1' is either undeclared or was never assigned. C:\Projects\MyApp\src\MyApp\FormMain.Designer.cs 202 0 and a matching Warning 6 Could not find type 'MyCompany.Controls.MyApp.us...

SplitContainer that only resizes panel1

Is there a way to make the SplitContainer only adjust the size of panel1? I have a Vertical SplitContainer and when I move the splitter I would like the size of the first panel to increase/decrease, but rather than change the size of the second panel I want the form to increase and decrease in size. I created some code to increase/de...

WPF custom shape control

Hi I was wondering if it is possible to make a custom shape custom control. I need to make control which contains textbox, however the control must have a shape of triangle or sth more sophisticated than regular rectangle/square. ...

wxPython GridSizer.Add() not working for custom control

I'm trying to create a custom control based on wx.richtext.RichTextCtrl and I'm running into a problem. Whenever I attempt to add the custom control to a sizer, wxPython chokes with the error Traceback (most recent call last): File "pyebook.py", line 46, in <module> frame = MainFrame(None, 'pyebook') File "pyebook.py", line 14, ...

[Qt]Customising QTreeWidgetItem

I want to customise QTreeWidgetItem. I wish to add to it, two Toolbuttons and a string. Also I wish to add these to only one column in the treewidget. I tried to subclass QTreeWidgetItem but realised I coult not "paint" on it as it is not derived from QWidget. I then tried using QTreeWidget::setItemWidget(QTreeWidgetItem *item, int co...

Really strange ToolStripButton event problem

Hi all, I am making a CustomControl based on a ToolStripButton control, I am trying to know when the mouse is Hover the button to draw it differently. Here is a quick view of my code : private bool m_IsHover = false; ... protected override void OnMouseEnter(EventArgs e) { m_IsHover = true; Debu...

WPF Best Practices: Do custom controls work well with the MVVM design?

I was looking at creating a common control that I will be able to reuse on my pages: an AddressControl which has Address1, Address2, City, State, Zip, etc... Originally I just created a class (AddressEntity) that contained all these items and implemented INotifyPropertyChanged. I included that class as a DependencyProperty in my Code-Be...

ASP.NET Control Life Cycle - After Load View State

I am creating a custom control and I need to handle some logic AFTER LoadViewState (which may or may not be called depending on if the control was visible or not) and BEFORE LoadPostBack (which may or may not be called depending on if the control was visible or not). Is there anything in the control lifecycle that will accommodate this...

If(!IsPostBack) In Parent's Page_Load Causes Breaks Custom Control's Click Event. Removing It Fixes Problem But Prevents Content From Loading!

Hi There. Thanks for reading. I have a custom control, comments.ascx. In that page, I have the following methods: protected override void OnInit(EventArgs e) { _presenter = new CommentsPresenter(); _presenter.Init(this, IsPostBack); } public Comments() { WebContext = ...

Silverlight 4: how to display list of custom controls (not in list order)

There are following object: 'FieldItem' custom control; 'Field' - ... XAML-object, which will contains a dozen of field items; FieldItemViewModel - data class that hosts data to be displayed with 'FieldItem' custom control; position of 'FieldItem' control depend from data entity parameters that is bounded to the control (X and Y); item...

WPF Lookless control not showing in VS designer

I have a lookless control I've built that has a default style defined in generic.xaml in my Themes directory. I also have the following in the constructor. static MyControl() { DefaultStyleKeyProperty.OverrideMetadata(typeof(MyControl), new FrameworkPropertyMetadata(typeof(MyControl))); } public MyControl() { //DoSomeWo...

How to subclass a WPF ComboBox to add an extra button

I saw a similar question and hoped for a solution, but simply giving an advice to subclass the ComboBox is not enough for me. I need it in small spoons... The case is I need an extra button on my special comboBox for adding new records to the item list. I have this as an UserControl today but it doesn't look good and I need more control...

Do I have to create a custom control as lookless?

I am creating a custom control derived from the one of the Standard WPF controls. The control has several constituent parts,and I am only modifying one of those parts. Here's my question: If I am modifying only one part of a control, do I have to declare the control as lookless and reproduce the entire control template for the modified ...

TargetTypes for Custom Control Templates?

I am extending the WPF Calendar control, and I have copied the control templates for the Calendar, CalendarItem, CalendarButton, and CalendarDayButton to the Generic.xaml of my custom control. The TargetType for the Calendar control template is my custom control, FsCalendar: <!-- Calendar Control Template --> <Style TargetType="{x:Type ...

How do I expose custom control properties inside a user control?

I have a custom control called TextBoxWithLabelAndUnits. From the name, you can tell that it's a TextBox that has a Label before it and a Label after it, so that the custom control looks like this: ----------------- Label: | | units ----------------- I expose several dependency properties to configure the c...