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
19
votes
2 answers

TextBlock text wrapping in GridViewColumn.CellTemplate not working

I am having problems getting the TextWrapping to work in this example. Can anyone see what I am duing wrong here?
mola
  • 1,120
  • 1
  • 8
  • 22
18
votes
6 answers

WPF/XAML: How to make all text upper case in TextBlock?

I want all characters in a TextBlock to be displayed in uppercase
feralbino
  • 181
  • 1
  • 1
  • 3
18
votes
5 answers

WPF: Binding Visibility by string contents

Ok, so here is my XAML: If InstanceName is null or an empty string, I want Visibility="Collapsed". Otherwise I want Visibility="Visible". How would I do that?
Jonathan Allen
  • 68,373
  • 70
  • 259
  • 447
17
votes
2 answers

Create DataGridTemplateColumn Through C# Code

I have a dynamic Datagrid that I have created. I am creating each column for it through code behind. I am having troubles on a column that I want to be displayed at a textblock when not editing, but as a combobox while editing. I have an…
Eric R.
  • 1,105
  • 3
  • 21
  • 48
15
votes
6 answers

Display images in TextBlock (WPF)

I'm working on a simple chat application. Currently the messages are binded to a custom-styled listbox like this (simplified XAML):
lacop
  • 2,024
  • 4
  • 22
  • 36
15
votes
3 answers

Add carriage return to string resource in WPF

My applications store all localized text in a string resource dictionary as suggested here http://msdn.microsoft.com/en-us/library/bb295251(VS.85).aspx
Brent Lamborn
  • 1,370
  • 3
  • 17
  • 37
15
votes
5 answers

How do I measure the size of a TextBlock in WPF before it is rendered?

I have a WPF DataTemplate with two TextBlock controls (stacked) and then some other elements underneath. Due to some complicated layout code, I need to know the height of the two TextBlock elements so that I can draw some fancy connector lines, and…
Scott Whitlock
  • 13,739
  • 7
  • 65
  • 114
14
votes
1 answer

Multiple Run elements in WPF Style setter

Is it possible in XAML to define multiple Run's inside a Style setter? The following has two Run's defined and fails: The property 'Value' is set more than once.