custom-controls

Create a custom label that implements IPostBackDataHandler

不羁的心 提交于 2020-01-15 16:38:31
问题 I want to create a label that implements the IPostBackDataHandler, because I want to change the text with javascript. If I trigger a postback after that, than my text is gone. The code that I already have is this: public class CustomLabel : Label, IPostBackDataHandler { protected override void OnPreRender(EventArgs e) { base.OnPreRender(e); if (Page != null) Page.RegisterRequiresPostBack(this); } public bool LoadPostData(string postDataKey, System.Collections.Specialized.NameValueCollection

Stop containing button from handling input - Silverlight

蹲街弑〆低调 提交于 2020-01-15 12:44:08
问题 I'm working on a custom button where the content is sometimes a textbox. I'm doing this so I have a sort of edit-in-place where you can type text, hit enter, and then the textbox disappears and the button's text is what was typed. So as a simple case, you could mock this up like so: <Button> <TextBox /> </Button> The problem is if you hit the <space> or <enter> while typing it'll "click" the button instead of input those keystrokes into the textbox. Now, like I said, this is a custom button

Stop containing button from handling input - Silverlight

南笙酒味 提交于 2020-01-15 12:42:26
问题 I'm working on a custom button where the content is sometimes a textbox. I'm doing this so I have a sort of edit-in-place where you can type text, hit enter, and then the textbox disappears and the button's text is what was typed. So as a simple case, you could mock this up like so: <Button> <TextBox /> </Button> The problem is if you hit the <space> or <enter> while typing it'll "click" the button instead of input those keystrokes into the textbox. Now, like I said, this is a custom button

C# WPF Programatically created DataTemplate Dockpanel in Stackpanel has no effect

人盡茶涼 提交于 2020-01-15 08:20:19
问题 I'm trying to dynamically create a datatemplate for a listbox. This is for a Custom UserControl. This UserControl has a DependencyProperty which accepts any types of IEnumerable<> . This works fine... But the Output is always Property / Value Property / Value if the objects contains 2 Properties. But i want that the properties are arranged side by side. Like: Object 1: Porperty / Value Property / Value Object 2: Property / Value Property / Value So where am i wrong ? i'm making first a

C# WPF Programatically created DataTemplate Dockpanel in Stackpanel has no effect

匆匆过客 提交于 2020-01-15 08:18:08
问题 I'm trying to dynamically create a datatemplate for a listbox. This is for a Custom UserControl. This UserControl has a DependencyProperty which accepts any types of IEnumerable<> . This works fine... But the Output is always Property / Value Property / Value if the objects contains 2 Properties. But i want that the properties are arranged side by side. Like: Object 1: Porperty / Value Property / Value Object 2: Property / Value Property / Value So where am i wrong ? i'm making first a

Difference between approches for setting DefaultStyleKey

南楼画角 提交于 2020-01-14 08:48:29
问题 I am creating a custom control(deriving from Control ) and want to define a default theme for the control. Previously all the custom controls I created, I have used static IntegerUpDown() { DefaultStyleKeyProperty.OverrideMetadata(typeof(IntegerUpDown), new FrameworkPropertyMetadata(typeof(IntegerUpDown))); } with this assembly attribute: [assembly: ThemeInfo(ResourceDictionaryLocation.SourceAssembly, ResourceDictionaryLocation.SourceAssembly)] Alternative approach to do this is (which I have

How to make a SlideBar(TrackBar) that have two handles(needles)

孤街浪徒 提交于 2020-01-14 02:52:07
问题 My Question is that i have to make a SlideBar(TrackBar) that have two handles(needles) 1- Minmum(Lower Value) 2- Maximum(Upper Value) Like: Start <------------------||--------------------------||------------------------>End In fact may required range is two long about 2000 ticks onto slidebar. so far I have searched on the internet and i found an example of Slidebar at code project: http://www.codeproject.com/Articles/28717/A-custom-range-selector-control-in-C-with-a-little it has the option

Why custom control task pane does not update its properties?

北城余情 提交于 2020-01-13 14:57:11
问题 I have designed a custom panel which can expand or collapse form at run time. When I change its height from custom designed task, it does not update it. Code of my control class: using System; using System.Windows.Forms; using System.ComponentModel; using System.ComponentModel.Design; using System.Windows.Forms.Design; [Designer(typeof(MyControlDesigner))] public partial class ExpandCollapsePanel : UserControl { private bool flag = false; private Size size; public int usrVerticalSize; public

BlackBerry - TreeField with CheckBoxField?

妖精的绣舞 提交于 2020-01-13 05:38:31
问题 Is it possible to add a CheckBoxField to a TreeField in BlackBerry ? If yes, how do I do it? 回答1: Same trick as with ListBox CheckBoxes: alt text http://img441.imageshack.us/img441/5120/checkboxtree.jpg class CBTreeField extends VerticalFieldManager implements TreeFieldCallback, DrawStyle { boolean[] mBooleanValues = new boolean[] {}; String[] mStringValues = new String[] {}; public boolean getNodeBooleanValue(int node) { return mBooleanValues[node]; } public void setNodeBooleanValue(int node

Is it possible to make diagonal column headers in JavaFX?

余生长醉 提交于 2020-01-11 11:50:14
问题 My JavaFX TableView looks something like this: It would be so much more pleasing and efficient if the labels at the top were diagonal to save space. I imagine it like so: The goal is to make the column fit closely to the content despite a long header label. Can it be done? 来源: https://stackoverflow.com/questions/46164114/is-it-possible-to-make-diagonal-column-headers-in-javafx