custom-controls

Custom Combobox control custom datasource with custom displaymember and valuemember

我的梦境 提交于 2019-12-11 18:47:18
问题 I'm developing a custom combobox control that inherits from another combobox (Janus UICombobox). I'd like the datasource to be based on a EntityType (LLBLGEN) so that when a user selects a EntityType all the database records for that EntityType will be loaded in the combobox. This is going fine when I build and run, but I would also like to be able to give the user the apportunity to select the DisplayMember and ValueMember based on the selected EntityType. I have the following code: public

Imagebutton change source property

别等时光非礼了梦想. 提交于 2019-12-11 17:09:18
问题 I'm developing a Windows Phone app. I have a custom button with an image inside. This is its XAML code: <ControlTemplate x:Key="ImageButton" TargetType="Button"> <Grid> <Image Margin="45,8,35,8" Source="Images/Delete.png"/> </Grid> </ControlTemplate> How can I change Image Source property programmatically? 回答1: To change the source of an image you need to make a new bitmap of your asset and set it as a souce BitmapImage myBitmapImage = new BitmapImage(new Uri("/Images/foo.png", UriKind

How to extract current Android layout segments into their own custom control?

旧巷老猫 提交于 2019-12-11 14:54:58
问题 OK, I have a complete layout built; however, I am not really pleased with the long xml file that has resulted. I have a shorted version of the xml outline and designer view below. And I was wondering how I can abstract out each group of similar components into their own custom control. For example, in the picture below, I have highlighted one such control that I would like to abstract out. Instead of it being a LinearLayout with 2 TextView 's inside with their own properties and attributes

Textbox to capture user's keyboard strokes

社会主义新天地 提交于 2019-12-11 14:17:55
问题 On one of the pages, there is a need for me to add a textbox in which the user types in text. It is important for us to capture what the user is thinking while he's typing in the text, so strokes such as backspace, keys should be captured. Once the user clicks on the submit button, the administrator should be able to 'play' the actions and review how the user progressed while he was typing in the text (similar to watching a video) What would be the asp.net mvc or webforms way of doing this?

How to change custom control's background color based on its property

纵饮孤独 提交于 2019-12-11 13:59:35
问题 I have simple custom control that shows a message to user (something like browser's Info bar). I have added a Boolean Dependency Property that indicate an error message. If flag is set the background color of control should be red otherwise yellow. Here is style for the control(in Themes\Generic.xaml): <Style TargetType="{x:Type local:InfoBar}"> <Setter Property="Template"> <Setter.Value> <ControlTemplate TargetType="{x:Type local:InfoBar}"> <ControlTemplate.Triggers> <Trigger Property=

Detect design mode in “OnApplyTemplate” method - custom control

牧云@^-^@ 提交于 2019-12-11 13:54:57
问题 Here is how my OnApplyTemplate looks: public override void OnApplyTemplate() { base.OnApplyTemplate(); if (DesignerProperties.IsInDesignTool) return; this.partTextBox = this.GetTemplateChild(PartTextBox) as TextBox; this.partButton = this.GetTemplateChild(PartButton) as Button; if (this.partTextBox == null || this.partButton == null) { throw new NullReferenceException("Template part(s) not available"); } this.partTextBox.LostFocus += this.OnTextBoxLostFocus; this.partButton.Click += this

Blackberry - how to add fields to listfield?

妖精的绣舞 提交于 2019-12-11 13:54:01
问题 I am using ListField but encouter a problem. How can i view it as i wish (not one by one)? For instance, there is item1, item2, item3. Can i jump from item1 to item3 directly, ignoring item2 ? In another way, how to insert a text field (a labelfield, for example) into the ListField items? like this: item1 a textlabel item2 item3 ...... let me describe it in another way: that is, how to insert a text field(a labelfield,for example) into the ListField items. like this: item1 a textlabel item2

How to bind to a custom property in a Silverlight Custom control

我的梦境 提交于 2019-12-11 13:39:48
问题 I've created a custom control with, amongst others, the following: public partial class MyButton : UserControl { public bool Enabled { get { return (bool)GetValue(EnabledProperty); } set { SetValue(EnabledProperty, value); SomeOtherStuff(); } } } public static readonly DependencyProperty EnabledProperty = DependencyProperty.Register("Enabled", typeof(bool), typeof(MyButton), new PropertyMetadata(true)); public static void SetEnabled(DependencyObject obj, bool value) { obj.SetValue

customized keypad on the iPhone Application

巧了我就是萌 提交于 2019-12-11 13:18:48
问题 i have requirement of creating a applicartion will different language other than English. I research over then internet and found i would have to create my own iphone keypad for this. I found this post very useful. I tried to make a custom keyboard but could not succeded. The application crashed as a press button of the custom keyboard. The button could not found its TouchUpInside event and crashes. I know i am missing something and i am very close to this. Here is a sample application i made

How to use Xamarin Forms Custom Button Renderer's Touch event to change the Buttons Image

人走茶凉 提交于 2019-12-11 13:03:24
问题 I figured it out. For anyone needing this. Please see the following. After Watching Xamarin Evolve a million times I caught on. class LoginButtonCustomRenderer : ButtonRenderer { protected override void OnElementChanged(ElementChangedEventArgs<Xamarin.Forms.Button> e) { base.OnElementChanged(e); Android.Widget.Button thisButton = Control as Android.Widget.Button; thisButton.Touch += (object sender, TouchEventArgs e2) => { if (e2.Event.Action == MotionEventActions.Down) { System.Diagnostics