Questions tagged [textblock]

TextBlock is a WPF control for displaying small amounts of text.

TextBlock is a WPF control for displaying small amounts of text. It also allows to format parts of the content by using different Inlines (e.g. Run, Span, Hyperlink)

1073 questions
27
votes
3 answers

Xaml TextBlock set round corner

I am trying to set rounded corner of TextBlock in xaml. But there is no such property.
Ajay
  • 6,418
  • 18
  • 79
  • 130
27
votes
5 answers

C# Hyperlink in TextBlock: nothing happens when I click on it

In my C# standalone application, I want to let users click on a link that would launch their favorite browser. System.Windows.Controls.TextBlock text = new TextBlock(); Run run = new Run("Link Text"); Hyperlink link = new…
Nicolas Raoul
  • 58,567
  • 58
  • 222
  • 373
25
votes
1 answer

WPF TextBlock Color for each Character

how to get each character of a textblock of different color in wpf?
chetan
  • 361
  • 2
  • 4
  • 5
24
votes
4 answers

Set TextBlock to preserve white space at the beginning and at the end?

EDIT: The code below actually works as I want - this question a little misleading. Please ignore it. Normally when I set Text property of TextBlock like this: TextBlock tb = new TextBlock(); tb.Text = " Hello World "; The whitespace at the…
Rasto
  • 17,204
  • 47
  • 154
  • 245
24
votes
5 answers

Get Displayed Text from TextBlock

I have a simple TextBlock defined like this
Fredrik Hedblad
  • 83,499
  • 23
  • 264
  • 266
23
votes
1 answer

WPF - How do I default the Visibility of a databound Textblock?

This Textblock, defined below, shows when the window first loads because it has no Datacontext (and hence the converter code is not run) until an item has been selected from another control e.g. TreeView.
empo
  • 1,133
  • 5
  • 21
  • 41
23
votes
3 answers

WPF - How to right align a textblock inside a horizontally oriented stackpanel?

This should be so simple - I've been hitting my head against my desk for so long trying to make a seemlingly simple task work (makes me feel like WPF is un-intuitive or buggy)... In any case, I've got a Stackpanel which is set to horizontal…
bugfixr
  • 7,997
  • 18
  • 91
  • 144
21
votes
3 answers

making textblock readonly

currently i have a textblock placed in a scroll viewer control. How do i make the textblock read only?
jeremychan
  • 4,309
  • 10
  • 42
  • 56
21
votes
7 answers

How to represent Line Break or new line in silverlight textBox

I am having hard time to match Special characters set in Silverlight. I only on the following: To represent a LineBreak in Silverlight TextBlock: use : > lineBreak < But What do I use to represent a New Line or LineBreak In Silverlight…
MilkBottle
  • 4,242
  • 13
  • 64
  • 146
21
votes
8 answers

"Clickable" textblock?

I have a WP7 app where I would like to have a "clickable" TextBlock area, that when a user clicks on the TextBlock, it puts it into edit mode (a different control). This would add another explicit step for a user before editing text. There is no…
pearcewg
  • 9,545
  • 21
  • 79
  • 125
21
votes
2 answers

C# WPF - ScrollViewer + TextBlock troubles

I have a TextBlock within a ScrollViewer that aligns with stretch to its window. I need the TextBlock to behave as the following: Resizes with window, no scrollbars When resized below a certain width the TextBlock needs to keep a MinWidth and…
jonathanpeppers
  • 26,115
  • 21
  • 99
  • 182
20
votes
7 answers

Align bottoms of text in controls

The following snippet:
Shimmy Weitzhandler
  • 101,809
  • 122
  • 424
  • 632
20
votes
1 answer

How to TextWrap a TextBlock within a width Auto Column?

Consider something as follows:
King Chan
  • 4,212
  • 10
  • 46
  • 78
19
votes
11 answers

WPF TextBlock highlight certain parts based on search condition

I have TextBlock that has Inlines dynamicly added to it (basically bunch of Run objects that are either italic or bold). In my application I have search function. I want to be able to highlight TextBlock's text that is in being searched for. By…
Daniil Harik
  • 4,619
  • 10
  • 55
  • 60
19
votes
3 answers

Is this slow WPF TextBlock performance expected?

I am doing some benchmarking to determine if I can use WPF for a new product. However, early performance results are disappointing. I made a quick app that uses data binding to display a bunch of random text inside of a list box every 100 ms and…
Ben Schoepke
  • 789
  • 2
  • 7
  • 17
1 2
3
71 72