New line in the text box - c#-4.0

I'm the Inter-key in textBox.But the new line will not.What do I need.
Whether there is a solution ?

<TextBox
Name="tbMultiLine"
TextWrapping="Wrap"
AcceptsReturn="True"
VerticalScrollBarVisibility="Visible"
>
This TextBox will allow the user to enter multiple lines of text. When the RETURN key is pressed,
or when typed text reaches the edge of the text box, a new line is automatically inserted.
</TextBox
See How to: Create a Multiline TextBox Control

Use a Textblock and set the following parameters in your XAML:
<TextBox name="textBox1"
TextWrapping="Wrap"
VerticalScrollBarVisibility="Visible"
AcceptsReturn="true"/>

Related

Android Studio Widget, Text Field, Large, Medium and Small Text is missing all I have is Plain which gives a Name. How can I get it and others?

I'm looking at Youtube examples and I see the instructor has Widgets I don't have, Like different size Text Fields and an analogue clock.
Is there somewhere I can get more Widgets?
I obtained a text size same as to the "tutorial" using:
android:textAppearance="#style/TextAppearance.AppCompat.Large"
Looks like AndroidStudio has undergone some change. Best option is to enter the "Text" mode and type the style yourself. For ex. if you need an equivalent of LargeText view, then add a TextView and move onto the Text mode and add this line:
android:textAppearance="#style/?android:attr/textAppearanceLarge"
Or you could also edit the properties of TextView too.
You should add this line android:textAppearance="#android:style/TextAppearance.Large"
inside the TextView after clicking on the Text tab near Design tab located in the middle left to the right of design tab.
but you have to consider that first of all you need to drag and drop TextView from Widgets into the user interface or Design section.
Click into the Text tab located middle left to the right of the Design tab, find the TextView element and within it simply enter this line of code:
style="/?android:attr/textAppearanceLarge"
Remember this line of code has to be within the element in order for it to work.
Go to properties and then select text appearance and select app.
combat.large
Use this:
android:text="Large Text"
android:textAppearance="?android:attr/textAppearanceLarge"
Add it inside your Textview tag.

AutoSuggestBox restores Text after pressing Escape

I'm using an AutoSuggestBox to perform Search. It works as expected except when I set the Text property programmatically.
As an example, let's assume the following xaml:
<Grid Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
<StackPanel Orientation="Vertical" VerticalAlignment="Center">
<AutoSuggestBox x:Name="SearchBox" />
<Button Content="Clear" Click="ButtonBase_OnClick"/>
</StackPanel>
</Grid>
On the Click event handler, I've put:
SearchBox.Text = string.Empty;
SearchBox.Focus(FocusState.Programmatic);
As you can see, the goal here is to Clear the AutoSuggestBox text. After I click on the button the Text is cleared but, if I press Escape, the previous Text is restored.
Is there any way to override this escape behaviour?
Thanks.
DMVC

Draggable TextBox in WPF

Is there any way to create a draggable textbox in WPF ? I can see lot of ways of creating draggable TextBlock in WPF. But can't find a similar way to achieve this for Textbox.
Normally a drag is started if the mouse is moved a few pixels while at least one mouse button is down. This "pattern" also appears when selecting text in a textbox. It seems there will be no way to tell this actions apart, so this might be the reason there is no "movable textbox" designed this way.
As a possible way to solve your problem you could take this approach into account: Universally usable editable label
Alternatively you could add some area to your textbox, which reacts to moving.
<StackPanel Orientation="Horizontal">
<Rectangle x:Name="DraggablePart" .../>
<TextBox .../>
</StackPanel>
Or even some kind of adorner, which will appear only, when the textbox is hovered.

Prevent the listview from scrolling to its top position when ItemSource changed Windows 8.1

So is there a way to stop scrolling up ?
I have listview's scrollview and i tryed saving last position and in listview size changed scroll down - but it first scrolls down and later up ;/ Maybe there is some different event or completly different way ?
You can set the ItemsStackPanel's ItemUpdatingScrollMode.
<ListView>
<ListView.ItemsPanel>
<ItemsPanelTemplate>
<ItemsStackPanel ItemsUpdatingScrollMode="KeepScrollOffset" />
</ItemsPanelTemplate>
</ListView.ItemsPanel>
</ListView>
It only works when the scroll offset is greater than 0, so just scroll using ChangeView() to set it up.

WiX Simple Line Break?

Using 3.5 and I just want a newline character in my Text Element:
<Dialog><Control><Text>
The [Wizard] will install [ProductName]
on your computer.
Click Next to continue or Cancel to exit the [Wizard].
</Text></Control>....
That does not seem to insert a new line character. How can I get a linebreak in there?
Thanks.
Unfortunately Windows Installer doesn’t support line breaks in static text controls. During installation the text is automatically formatted based on control and font sizes.
However, if you really want a line break, simply use another static text control for the next line.
The official answer from Microsoft regarding line breaks in Text controls reads as follows:
The recommended method for displaying text with specified line breaks is to use multiple one-line text controls located below each other. The character sequences \n, \r\n, or \n\r in the text field for the control are not displayed as a line break. These character sequences are literally displayed by the control.
Use CDATA as stumbled upon in this question:
<Control><Text>
<![CDATA[
This is my text.
With a return line
]]>
</Text></Control>
Building on Adam's answer you can also format your text into a WixLocalization entry.
Example:
<WixLocalization xmlns="http://schemas.microsoft.com/wix/2006/localization" Culture="en-US">
<String Id="WelcomeDlgDescription">
This is a custom welcome message.
Click Next to continue or
Cancel to exit.</String>
</WixLocalization>
And use it in your control like this:
<Control Id="Description" Type="Text" X="50" Y="20" Width="200" Height="60" Transparent="yes" NoPrefix="yes" Text="!(loc.WelcomeDlgDescription)"/>

Resources