textbox

Textbox disabled with a huge string

。_饼干妹妹 提交于 2019-12-18 07:08:17
问题 I'm having a issue with a textbox when it's typed a huge string. In my case, the textbox is used to write email addresses, and it doesn't have a limit of chars. So, I've made this test: I wrote 200 email addresses in a notepad, and I pasted the text on the textbox and the text disappeared, but if I change the focus of the control, the text is displayed again. I already saw this link, but it doesn't helped me. I already tried to change the MaxLength property to 0 (how the microsoft says to do)

dynamically increase input type text textbox width according to the characters entering into it

别说谁变了你拦得住时间么 提交于 2019-12-18 06:57:28
问题 I have a textbox where the user can enter any number of characters, But I want its width to be increased dynamically with respect to the number of characters entered into it . I have done a workaround shown below and it works partially, it will increase the width dynamically but not so precisely and will hide the first entered characters after a while because of my poor logic applied in it. I've just given a wild cutoff of 17 characters count to start the increment. It should start the width

How to suppress Cut, Copy and Paste Operations in TextBox in WPF?

廉价感情. 提交于 2019-12-18 06:07:08
问题 I want to suppress Cut, Copy and Paste operations in Text Box. I don't want user to do any of these operations through keyboard or from default context menu in the text box . Please let me know how can I restrict these operations? 回答1: You can do this pretty easily using the CommandManager.PreviewCanExecute routed event. In your XAML, you would put the following on your TextBox element. This will apply to CTL+V, etc as well as the context menu or any buttons that you may have mapped to those

How to suppress Cut, Copy and Paste Operations in TextBox in WPF?

耗尽温柔 提交于 2019-12-18 06:07:02
问题 I want to suppress Cut, Copy and Paste operations in Text Box. I don't want user to do any of these operations through keyboard or from default context menu in the text box . Please let me know how can I restrict these operations? 回答1: You can do this pretty easily using the CommandManager.PreviewCanExecute routed event. In your XAML, you would put the following on your TextBox element. This will apply to CTL+V, etc as well as the context menu or any buttons that you may have mapped to those

How to select multiple controls by mouse-dragging over them

老子叫甜甜 提交于 2019-12-18 05:11:49
问题 I want to be able to drag over a bunch of controls and select those of a certain type (TextBoxes). Once the dragging action has been completed, I want to display an inputbox (yes, I'll have to reference/use the VB .dll) prompting the user for the value that will be entered in each selected TextBox. Can this be done? (of course, but how?) Or is there another way to accomplish the same thing (allow the user to quickly select multiple controls and then perform an action on all of them at once)?

Only accept digits for textbox

别说谁变了你拦得住时间么 提交于 2019-12-18 04:52:48
问题 I found this code for making my textbox only accept numbers. Private Sub TextBox1_KeyPress(ByVal sender As System.Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles TextBox1.KeyPress Dim allowedChars As String = "0123456789" If allowedChars.IndexOf(e.KeyChar) = -1 Then ' Invalid Character e.Handled = True End If End Sub But... the user can't delete the numbers using the backspace button. How do I do then? 回答1: You also need to handle pasted text (there may not be a keypress).

Allow TextBox to be resized but not to grow on user input

我与影子孤独终老i 提交于 2019-12-18 04:43:09
问题 I have a TextBox defined inside a window like so: <Window x:Class="NS.MainWindow" ... SizeToContent="WidthAndHeight"> <Grid> <Grid.ColumnDefinitions> <ColumnDefinition Width="100" /> <ColumnDefinition MinWidth="200" /> </Grid.ColumnDefinitions> <Grid.RowDefinitions> <RowDefinition MinHeight="50" /> </Grid.RowDefinitions> <TextBlock Grid.Column="0" Grid.Row="0">Description:</TextBlock> <TextBox Grid.Column="1" Grid.Row="0" TextWrapping="WrapWithOverflow" /> </Grid> </Window> The problem is

WPF textbox with image

删除回忆录丶 提交于 2019-12-18 02:58:08
问题 I'm doing a WPF login interface. In my login panel, I have one login TextBox and a PasswordBox . As what shown in the first image below, there is a little human logo in the login textbox and a lock in the password box. I set the image into the textbox background, and then when i try to insert some word into the login box, the words will overide the human logo(image B). Any advice to make it right? My XAML: <TextBox Width="380" Height="25" HorizontalAlignment="Center" Foreground="WhiteSmoke"

Accessing Textboxes in Repeater Control

亡梦爱人 提交于 2019-12-17 22:58:35
问题 All the ways I can think to do this seem very hackish. What is the right way to do this, or at least most common? I am retrieving a set of images from a LINQ-to-SQL query and databinding it and some other data to a repeater. I need to add a textbox to each item in the repeater that will let the user change the title of each image, very similar to Flickr. How do I access the textboxes in the repeater control and know which image that textbox belongs to? Here is what the repeater control would

Set ListBoxItem.IsSelected when child TextBox is Focused

为君一笑 提交于 2019-12-17 22:54:38
问题 I have a typical MVVM scenario: I have a ListBox that is binded to a List of StepsViewModels. I define a DataTemplate so that StepViewModels are rendered as StepViews. The StepView UserControl have a set of labels and TextBoxs. What I want to do is to select the ListBoxItem that is wrapping the StepView when a textBox is focused. I've tried to create a style for my TextBoxs with the following trigger: <Trigger Property="IsFocused" Value="true"> <Setter TargetName="{Binding RelativeSource=