custom-controls

JavaFX 2.0 - create action handler for custom component in FXML

社会主义新天地 提交于 2019-12-11 06:39:33
问题 I want to add a custom action in my new component. How to do this? Example code: Component public class MyCustomComponent extends Region { public MyCustomComponent(){ super(); this.setOnMouseClicked(new EventHandler<MouseEvent>(){ @Override public void handle(MouseEvent event) { /* throw my custom event here and handle it in my FXML controller - but how? :-( */ } }); } } Controller public class MyController { @FXML protected void myCustomAction(ActionEvent event) { // do something } } FXML:

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

青春壹個敷衍的年華 提交于 2019-12-11 06:37:26
问题 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://schemas.microsoft.com/winfx/2006/xaml" xmlns:local="clr-namespace:MyNamespace"> <!-- This is the dictionary--> <ResourceDictionary x:Name=

Custom Radio button in android app doesn't get grayed out on disabling that

泄露秘密 提交于 2019-12-11 05:37:53
问题 I have a custom radio button in android. Its works fine. My problem is that When I make those button disable it will not grayed out. How can I do so? Here is my sample code for custom radio button. <?xml version="1.0" encoding="utf-8"?> <selector xmlns:android="http://schemas.android.com/apk/res/android"> <item android:state_checked="true" android:drawable="@drawable/radio_select" /> <item android:state_checked="false" android:drawable="@drawable/radio_holo" /> </selector> Here is code which

Blackberry - single line BasicEditField with large text

。_饼干妹妹 提交于 2019-12-11 05:20:02
问题 I have created a customized BasicEditField with Border using Bitmap.Now while typing the text,it crosses the border of the BasicEditField . This is my code class customEditField1 extends EditField { Bitmap mBorder = null; customEditField1(Bitmap borderBitmap) { mBorder = borderBitmap; } protected void paint(Graphics graphics) { graphics.drawBitmap(0, 0, mBorder.getWidth(),mBorder.getHeight(), mBorder, 0, 0); super.paint(graphics); } } I want to create a BasicEditField which should hide the

WPF custom textbox takes two tabs to get to text?

痞子三分冷 提交于 2019-12-11 05:08:20
问题 I have a custom textbox control that displays its name when there is no text inside of it, but for some curious reason I have to hit tab twice to get from the previous element to get into the control's text field. On the first tab it highlight's the TextBox's border. I went through all of the levels of the Generic.xaml file with the properties window open and searching for 'tab' but the only one that I could find was on the TextBox itself which is properly tabstopping. How do I make my

Force update notifications for DependencyProperty even when it doesn't change

非 Y 不嫁゛ 提交于 2019-12-11 04:47:11
问题 I have a custom WPF control. It has a typical DependencyProperty , let's call it Status , which is updated periodically via binding. (More specifically, it is bound to a property which sends notifications according to INotifyPropertyChanged ). I want to implement a certain 'expiration' behaviour: if Status is not updated for a certain time, something happens. Ideally, this logics should be within my custom control (I have many instances of it). I set up a DispatcherTimer in the Status change

Hide ellipsis (…) button of expandable property like “…” button of font property in the property grid

一个人想着一个人 提交于 2019-12-11 04:39:23
问题 I've added a new property to my custom control as expandable property like font property in Property Grid. After using from my custom control in a Windows Forms Application project, I see an ellipsis (…) button like "…" button of font property in Property Grid. (For more information, please see the following picture.) Now, I want to hide the ellipsis (…) button for my new expandable property. Expandable property codes are: [DisplayName("Floors Information")] [Description("Floors

WinForms Application Theme

半腔热情 提交于 2019-12-11 03:55:43
问题 Is there any way to change the SystemColors.ButtonHighlight color only for my WinForms application? I would like to give a different theme to it. Thanks. 回答1: That would be nice, wouldn't it? I'm afraid the only options are to draw the button yourself (use Reflector to see how WinForms paints it), or buy a third-party skinning framework. 回答2: DotNetSkin provides a DLL which can be easily used in an application to change full theme including the title bar of the application that would not

How to make a TScrollbox out from TCustomControl?

Deadly 提交于 2019-12-11 03:33:51
问题 I have created a component that has a paint override on the canvas and i would like to set a limit on minimum width and height. The scrollbar should appear at the side when the Width Or Height is less then the limit just like a scrollbox and can be scroll also. i choose TCustomControl cause i paint and less flicker when double buffered. any idea or better solution? 回答1: TScrollBox and TCustomControl both descend from TWinControl . TScrollBox and TScrollingWinControl add scroll bars, whereas

Controls, properties, events and timers running in design time

[亡魂溺海] 提交于 2019-12-11 03:24:29
问题 Im using some custom control in vb.net, where I have a boolean property that, whenever it changes, it starts a timer if it's value is false or stops if it's true. If the timer runs for several seconds, it raises a messagebox that warns of a problem happening. The problem is that this messagebox shows even in design time. As I have traced, the default value for the property is false when the control loads in the winform in design time, it seems it starts the timer and when it ends raises the