Skip to main content

Posts

UWP - How to add a Hyperlink to a TextBlock

UWP - Add a Hyperlink to a TextBlock The TextBlock is the primary control for displaying read-only text in UWP apps. The UWP app developers can use it to display single-line or multi-line text, inline hyperlinks, and text with formatting like bold, italic, or underlined. The TextBlock is designed to display a single paragraph and it does not support text indentation. The following Universal Windows Platform application development tutorial demonstrates how we can add a Hyperlink to a TextBlock. Here we will display a Hyperlink inside two TextBlock texts. That means we will put a Hyperlink within the TextBlock text. For the first TextBlock control, we will add a Hyperlink inside the text using the XAML language. And for the second TextBlock control, we will put a Hyperlink within its text programmatically. For the first TextBlock control, we will use inline Run and Hyperlink elements to add a Hyperlink in the text. And for the second Text...

UWP - How to make TextBlock text selectable

UWP - Make TextBlock Text Selectable The TextBlock is the primary control for displaying read-only text in UWP apps. The UWP app developers can use it to display single-line or multi-line text, inline hyperlinks, and text with formatting like bold, italic, or underlined. The TextBlock is designed to display a single paragraph and it does not support text indentation. The following Universal Windows Platform application development tutorial demonstrates how we can enable text selection in a TextBlock control. Here we will set the TextBlock IsTextSelectionEnabled property value to true to enable text selection. We will also handle text selection changes by using the TextBlock SelectionChanged event and display the selected text to another TextBlock control. The TextBlock class IsTextSelectionEnabled property gets or sets a value that indicates whether text selection is enabled in the TextBlock, either through user action or calling selection-rel...

UWP - How to use TextBox SelectionChanged event

UWP - TextBox SelectionChanged Event The TextBox class represents a control that can be used to display and edit plain text. A TextBox can be single or multi-line. The TextBox control enables the UWP app user to enter text into a UWP app. The TextBox is typically used to capture a single line of text but the UWP developers can configure it to capture multiple lines of text. The text displays on the screen in a simple uniform plaintext format. The following Universal Windows Platform application development tutorial demonstrates how we can use the TextBox SelectionChanged event. Here we displayed the TextBox selected text on a TextBlock control when the TextBox selection changed. The TextBox SelectionChanged event occurs when the text selection has changed. The TextBox SelectionChanged event type is RoutedEventHandler. The RoutedEventHandler delegate represents the method that will handle routed events. The RoutedEventHandler(object sende...

UWP - How to use TextBox TextChanged event

UWP - TextBox TextChanged Event The TextBox class represents a control that can be used to display and edit plain text. A TextBox can be single or multi-line. The TextBox control enables the UWP app user to enter text into a UWP app. The TextBox is typically used to capture a single line of text but the UWP developers can configure it to capture multiple lines of text. The text displays on the screen in a simple uniform plaintext format. The following Universal Windows Platform application development tutorial demonstrates how we can use the TextBox TextChanged event. Here we displayed the TextBox entered text on a TextBlock control when the TextBox text changed. The TextBox TextChanged event Occurs when content changes in the text box. The TextBox TextChanged event type is TextChangedEventHandler. The TextChangedEventHandler delegate represents the method that will handle the TextChanged event. The TextChangedEventHandler(object sender,...

UWP - TextBox ScrollBar example

MainPage.xaml <Page x:Class="UniversalAppTutorials.MainPage" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:local="using:UniversalAppTutorials" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:Ignorable="d" > <StackPanel Padding="50" Background="AliceBlue"> <TextBox x:Name="TextBox1" PlaceholderText="Input some names here" Header="Names" Margin="5" AcceptsReturn="True" TextWrapping="Wrap" MaxHeight="100" ScrollViewer.VerticalScrollBarVisibility="Auto" /> <TextBox ...

UWP - How to change TextBox style

UWP - Change TextBox Style The TextBox class represents a control that can be used to display and edit plain text. A TextBox can be single or multi-line. The TextBox control enables the UWP app user to enter text into a UWP app. The TextBox is typically used to capture a single line of text but the UWP developers can configure it to capture multiple lines of text. The text displays on the screen in a simple uniform plaintext format. The following Universal Windows Platform application development tutorial demonstrates how we can set or change the TextBox styles. Here we will change two TextBoxes styles. For the first TextBox control, we will change its styles by using XAML properties. And for the second TextBox control, we will change its various style properties programmatically. The TextBox class FontFamily property gets or sets the font used to display text in the control. This TextBox property is inherited from Control. This property v...

UWP - Select TextBox all text when get focus

UWP - Select TextBox all text on focus The following Universal Windows Platform application development tutorial demonstrates how we can select all text of a TextBox when the specified TextBox gets focused. In this UWP tutorial, we will handle the TextBox class GotFocus event to select all text of this TextBox instance. We will use the TextBox class SelectAll() method to select TextBox all text when TextBox is focused. The TextBox class represents a control that can be used to display and edit plain text. A TextBox can be single or multi-line. The TextBox control enables the UWP app user to enter text into a UWP app. The TextBox is typically used to capture a single line of text but the UWP developers can configure it to capture multiple lines of text. The text displays on the screen in a simple uniform plaintext format. The TextBox GotFocus event occurs when the TextBox UIElement receives focus. The GotFocus event is raised asynchron...