textbox

Spacing added when switching control template dynamically

Deadly 提交于 2020-01-16 03:50:09
问题 I've implemented switching of TextBox with TextBlock on clicking. My goal was to show ... when the text becomes wider than the TextBox width I've followed this answer to come up with a solution. This is my current code: <TextBox x:Name="TextBox" Height="24" Width="300" Cursor="Hand" BorderThickness="0" Background="White" VerticalAlignment="Center" Text="{Binding MyCustomText}"> <TextBox.Style> <Style TargetType="TextBox"> <Setter Property="Background" Value="Yellow" /> <Style.Triggers>

Textbox in a C# XNA Game

只谈情不闲聊 提交于 2020-01-16 03:29:08
问题 I'm new to XNA. I'm making a game which needs level editor. I need a textbox to get a level name and its description. So I wrote a code like this: if (isSaveBox) { KeyboardState ks = Keyboard.GetState(); Keys[] keys = ks.GetPressedKeys(); Keys tempKey = Keys.None; foreach (Keys key in keys) { Keys currentKey = key; if (ks.IsKeyUp(lastKey)) { string toadd = key.ToString(); if (!(key == Keys.None) && key != Keys.Space && key != Keys.Back && key != Keys.Enter) { levelName += toadd; } else if

WPF bind numeric values in TextBoxes to change relative to each other

妖精的绣舞 提交于 2020-01-16 01:11:26
问题 How to bind multiple WPF TextBoxes holding numerical values to change the same absolute amount if one of the TextBox value is changed? Lets say I have the above UI. If the CheckBox is not checked, I need the regular binding to ViewModel property (this is what I have now): <TextBox Text="{Binding Value1}" /> <TextBox Text="{Binding Value2}" /> <TextBox Text="{Binding Value3}" /> <TextBox Text="{Binding Value4}" /> <TextBox Text="{Binding Value5}" /> <CheckBox Content="Relative Changes Constant

How to add an attribute to textbox in extension class

杀马特。学长 韩版系。学妹 提交于 2020-01-15 12:16:08
问题 I've created an extension class for Textbox as follows: using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.ComponentModel; using System.Text; using System.Web.UI; using System.Web.UI.WebControls; namespace MyApplication.App_Code { public class DateTextBox : TextBox { protected override void OnPreRender(EventArgs e) { //this is what iwant to do : //((TextBox)sender).Attributes.Add("placeholder", "dd/mm/yyyy"); base.OnPreRender(e); } } } I need to

Storing Textbox values into Database

删除回忆录丶 提交于 2020-01-15 10:47:05
问题 I am doing a crossword puzzle and i have 100 text boxes in a panel like this : Every text box have an id of 00 - 99 since there is 100 of it . First Row will have an id 00-09 , 2nd row will have an id of 10-19 and so on. When user types something in some text box will be null and some text box will have values in it. How do I save values from a text box of a certain id to a database? For example the above image, HELP , text box id of 22 will have the value H , id of 23 will have the value of

Textbox on canvas in j2me

荒凉一梦 提交于 2020-01-15 09:23:06
问题 I am going to make application on j2me using canvas. I want to take textbox or textfield on my canvas. 回答1: You can draw a basic textbox and display a string , and when it receives focus, you can switch the view to that particular textbox ,something like this textBox = new TextBox(....); Midlet.display.setCurrent(textBox); This would create your data entry more robust and save you from the pain of implementing various keyboard issues yourselves 回答2: These items are only available for adding

Slow WPF Textbox

两盒软妹~` 提交于 2020-01-14 19:25:08
问题 I am developing a simple serial data viewer that will be used to watch the data being transmitted to one of a computer's serial ports. I wrote a test application using C# and WPF; it simply places the most recently read line into a textblock. However, it skips every-other line. My theory is that new data is being put into the textblock before WPF renders the window. However, I've tried every combination of thread priorities I can think of and, at best, the application shows every other line;

C# Input validation for a Textbox: float

橙三吉。 提交于 2020-01-14 16:49:20
问题 This supposedly easy task gave me some headache. I simply want to let the user enter any text that succeeds float.TryParse into a Textboxish control. I could use a normal TextBox and check the Text in some btnOK_Click, but this is obviously lame. Also, there is a nice built-in MaskedTextBox control, but I failed to set it's mask to be equal to float.TryParse . Also, it seems to check for validity only when a focus change occurs. Digging around on the net brought some interesting ideas, but

C# Input validation for a Textbox: float

笑着哭i 提交于 2020-01-14 16:48:59
问题 This supposedly easy task gave me some headache. I simply want to let the user enter any text that succeeds float.TryParse into a Textboxish control. I could use a normal TextBox and check the Text in some btnOK_Click, but this is obviously lame. Also, there is a nice built-in MaskedTextBox control, but I failed to set it's mask to be equal to float.TryParse . Also, it seems to check for validity only when a focus change occurs. Digging around on the net brought some interesting ideas, but

C# Input validation for a Textbox: float

天大地大妈咪最大 提交于 2020-01-14 16:48:43
问题 This supposedly easy task gave me some headache. I simply want to let the user enter any text that succeeds float.TryParse into a Textboxish control. I could use a normal TextBox and check the Text in some btnOK_Click, but this is obviously lame. Also, there is a nice built-in MaskedTextBox control, but I failed to set it's mask to be equal to float.TryParse . Also, it seems to check for validity only when a focus change occurs. Digging around on the net brought some interesting ideas, but