开发者

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>
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜