Why is the text being cut off from this combobox? - c#

Here's a screen shot of the problem:
As you can see the left-most part of the string is getting truncated. This is just a standard combobox and there's nothing overlapping it on the form.

Your label is too long!
its overwriting the edge of that edit box.

Bring the combobox to the front. It seems like the label before your combobox is in front of it.

Just reproduced this.
As previous comments suggest, your label is most definitely too long.
Please reconsider the placement of your elements, perhaps the label should end with more space between the label and the combobox.
This can easily be done via the designer window (Shift + F7 whilst on the code behind e.g. form.cs)

Related

Disable line wrapping in .NET ListView

Can anyone help with this simple question.
I have a c# ListView. It's the only control on the form. The View property is set to details. When I resize the form I programmatically resize the ListView to fill the whole form.
Problem is, when the form width gets too small to show the lines of text in the ListView it wraps each onto more lines of text - I can just see the top of the characters of the second line.
Thing is, I would rather only have one line per item and the user would have to use the mouse to horizontally scroll the "too long" items - just like in an edit box when the text is too long.
Thanks for any help,
Mitch.

WPF MultiLine TextTrimming

We have a case where we need to display Character Ellipsis(i.e. show text as trimmed) when we have multiline text.
The textblock shows trailing ellipsis when the content is anyway bigger than the width of the multiline TextBlock (i.e. TextWrapping is set to Wrap).
But we have a case wherein, we need to show only one line with ellipsis whether the text width of the first line is greater than the width of textblock or not.
For example, consider the following sample text
String str = "1\n2\n3456\n45889";
textBlock.Text = str;
The TextBlock should display as shown below:
1...
and the ToolTip will show the entire text. I tried doing some research on the possibilities but could not find much help and was wondering if anyone in the community has encountered such a situation or perhaps could suggest me?
Since, we shouldn't change the underlying data object (real time scenario) but only change what is rendered to the user, I am guessing a Converter should do the trick but I am still stuck on how to proceed. Or do you guys have any other alternatives?
Create a custom control based off of the textblock which handles the business logic needed for the ellipse.
The binding of the actual text to a specific property can ensure that the text is not changed. While in a separate property you have the visual text with the ellipse which gets updated when the original text changes (the dependency property change event) and the visual text subsequently displayed on the screen. Also have the tooltip bound to the original text which helps in that scenario of showing the actual text and not the ellipsed text.
By creating an easy custom control you have the ability to handle the business logic all in one location and it can be used in other screens and projects.

Scrolling all but the top line in a multiline textbox

I have a multiline textbox in a WinForms application. What I'd like to do is always have the top line visible, even if it scrolls. Is there some trick someone knows to do this?
Fake it. Use two TextBox objects, draw your own borders. You will need to deal with wrapping to the next line yourself.
You could also copy the first X characters to a label so when the TextBox scrolls they can see the first line in the label.
Unless it is an essential feature I would try to cut it.
The simple answer; depending on the appearance you are going for is to use existing windows controls to get the effect you want.
You can use a label control above a textbox and allow the textbox to scroll.
You can use two textbox - the top with it's .multiline property set to false, while the bottom allows scrolling.
You could encapsulate this all into a user control for reuseability.
Beyond that, I think you'd be looking at a fairly large project to implement your control (or at least overriding the onPaint() event of the textbox) with the desired behavior.

Auto position textblock

i'm currently trying to position my textblock in a way where it would automatically load below the next textblock after eg i click a button. (Its like a messenger , just that the text are set by me depending on events)
Other than scrollviewer to contain more textblock if it overshoot the screen, what do i need to make that work? or do i have to set a textblock there and hide it :(
I'm currently testing it out in sketch flow, would be nice if someone can tell me what to use to get this done or refer me somewhere relalted
Thank you!
Regards,
RAinbow
Use a StackPanel control to put the TextBlock controls in. It will stack the text blocks below one another.

WPF Textbox "normal" text input

G'day,
I'm not sure if this is a problem relevant to only me or if anyone else has this issue also. None the less, I'll try and describe what is going on here.
I have a few textbox's, default style, etc. I set an explicit maxwidth and maxheight to prevent resize when the text exceeds the default width of the textbox. The issue is that the text wraps to the next line, but I only want single line. So I set maxlines to 1 and textwrapping to NoWrap. That's fine.
Now the carat and typed text disappears under the edges of the textbox when the width is exceeded and the only way I can get the carat and newly typed text back into view is by pressing the left and right arrows. Coming from MFC and using textboxes all the time with HTML, I would have thought the default behaviour would be to have the textbox content scroll with the carat or am I missing something here?
Thank you,
Ash
What you are requesting is actually the default behavior. Start with an empty grid and place a textbox on it. Type some text into the box and the text view will scroll with the caret.
Below is the XAML I tested with, perhaps you have a style interfering with it?
<Grid>
<TextBox MaxWidth="20" Height="20"></TextBox>
</Grid>

Categories