custom-controls

Using custom Controls in fxml

假装没事ソ 提交于 2019-12-05 12:50:33
Let's say I have subclassed the default TableView<T> class provided by javafx and created a class PersonTableView extends TableView<Person> . That subclass exists in java code and does not use fxml at all. It defines and encapsulates behaviour that I need specifically for my Person object. Now I want to use an instance of my custom class inside of an fxml file, just like I would use all the default controls. And that exactly is my problem, I don't know how I can do that, or if this is even a good / common design decision. I want to encapsulate the behaviour for my specific TableView inside its

How to minimize, maximize and restore down through buttons in java?

久未见 提交于 2019-12-05 12:04:42
I'm creating a JavaFX 2.2 program, and need to create custom UI controls (just those ever-present minimize-maximize/restore-close buttons on the top). I need to create custom buttons for that purpose, simple till just creating. I just need the real code for minimize and the maximize/restore buttons (close button was fairly a child's play). The minimize button restores the app to the taskbar. The maximize button, well, maximizes it to fit the user's screen and it toggles to restore button while maximized. When the restored button is clicked, the window gets restored to its initial size

WPF: How to create a custom items control panel?

删除回忆录丶 提交于 2019-12-05 10:35:32
I want to design a custom items control panel for a ListBox . There are 3 requirements: It should have the properties int rows and int columns which would define the matrix of cells that the panel is made of. This is what the panel should look like (colors are irrelevant, I just wanted to show that the panel is consisted of 12 empty cells in a 3x4 matrix): If the number of items in the items control is less than the number of defined cells all the cells should be drawn. E.g. if there are only 4 items to be placed in a 3x4 matrix shown in the picture, all of the cells should be drawn and only 4

WPF Custom Controls Are Invisible

♀尐吖头ヾ 提交于 2019-12-05 10:07:36
When I create a custom control in WPF and add it to a window, I don't see anything where I placed it in the dialog. Here's what I'm doing: Create a new WPF Application Add -> New Item... -> Custom Control (WPF): "CustomButton.cs" I change the CustomButton base class to Button instead of Control Add a CustomButton control to my main window. When I run the application or view the main window in the designer, I don't see anything. Here's what the code looks like. CustomButton.cs: public class CustomButton : Button { static CustomButton() { DefaultStyleKeyProperty.OverrideMetadata(typeof

custom control overlay on UIWebView on single Tap/Touch in iphone

时光毁灭记忆、已成空白 提交于 2019-12-05 07:43:04
问题 http://startupmeme.com/wp-content/uploads/2008/09/stanza-on-iphone.png I want to achieve functionality like the famous Stanza application screenshot shows. Content is displayed with the help of UIWebView in html format A single tap on the UIWebView would show two overlay controls (top & bottom) The bottom toolbar consists of controls & a slider to give pagination Please help. How would I achieve the above in following way: How do i build up these custom controls? On single tap, how will i

WPF - Creating a custom ItemsControl

孤人 提交于 2019-12-05 06:08:15
问题 I'm looking into creating custom controls for WPF and I've found some reasonably useful blogs and such that vaguely go into enough detail but I'm still struggling a bit. Basically, what I'm trying to create is something akin to the infamous 'Coda Slider' but i just don't know enough to get started properly. Can anyone either point me in the direction of someone/somewhere to give me the low-down on creating custom ItemControls or provide me with the basic information like what ItemsControl

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

我们两清 提交于 2019-12-05 04:48:38
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 is posted back, and the control's LoadPostData() method looks for the hidden input, and if the hidden input has data, creates the ListItem collection from it. This works perfectly so long as the user has made a selection from the list box . If they have not, the

Create custom FrameworkContentElement to add diagonal line over text in WPF

梦想的初衷 提交于 2019-12-05 04:43:31
Is there any way to create a custom FrameworkContentElement (or an Inline ) that draws a diagonal line over its content? Something like Strike-through decoration but with a diagonal shape: It is not possible to inherent from TextDecoration or TextEffect (they are sealed). Any idea? UPDATE : I tried to create an example as minimal as possible. In more complex scenarios you will have to extend this. Here is how it looks: this is the corresponding xaml: <AdornerDecorator> <StackPanel> <TextBlock> <Run>this is normal Text</Run><LineBreak/> <Run local:DiagonalStrikeThroughAdorner.StrikeThroughBrush

How to make a custom progressbar in Android?

孤街醉人 提交于 2019-12-05 03:42:08
What would be the best way to make somthing looking like this: The text on it needs to be customizable, not only numbers, some strings too, depending on context. From what I see it: Create a custom View and within onDraw perform all the calculations and text alignment. Style or extend a horizontal ProgressBar . What do you think ? Extend ProgressBar ... override onDraw() The primary reason for this is that all of the primary methods are already there and the first rule of object-orientated programming is code-reuse means don't reinvent the wheel. 来源: https://stackoverflow.com/questions/8929062

How do I specify a required attribute in a custom .NET Web control?

放肆的年华 提交于 2019-12-05 03:11:24
private string _itemId; [Browsable(true), Description("Required identifier for the Item.")] public string ItemId { get { return _itemId; } set { if (string.IsNullOrEmpty(_itemId)) { _itemId = value; } } } How would I actually make that required when someone uses the control? I'm trying to find an attribute that says something like Required(true). I don't know that there's an attribute for this. I believe on the Page_Load event (or perhaps some rendering event) just check if the value has been set. If not then throw an exception. I don't think this is possible. Consider that the designer needs