Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can't edit Textblock content in WPF

I'm working on my first WPF application and I notice that I'm not able to edit the text values in any of my textblocks.

I can't seem to find anything wrong here that would prevent me from changing it...

<Label Content="Line Terminator" Grid.Row="0" Grid.Column="0" Margin="5"></Label>
<Border BorderThickness="1" BorderBrush="LightBlue" Grid.Row="0" Grid.Column="1" Margin="5">
    <TextBlock x:Name="txtLineTerm" Focusable="True" IsManipulationEnabled="True" Padding="3"></TextBlock>
</Border>
<Label Content="Field Terminator" Grid.Row="0" Grid.Column="2" Margin="5"></Label>
<Border BorderThickness="1" BorderBrush="LightBlue" Grid.Row="0" Grid.Column="3" Margin="5">
    <TextBlock x:Name="txtFieldTerm" Focusable="True" IsManipulationEnabled="True" Padding="3"></TextBlock>
</Border>

Can anyone see the problem? I feel like there's a concept that I'm missing here. Any explanation will be greatly appreciated.

like image 502
Ortund Avatar asked Jan 30 '13 08:01

Ortund


People also ask

How do you make a text box non editable in WPF?

Solution 1Add IsReadOnly = "True" in xaml of textbox.

What is TextBlock WPF?

The TextBlock control provides flexible text support for UI scenarios that do not require more than one paragraph of text. It supports a number of properties that enable precise control of presentation, such as FontFamily, FontSize, FontWeight, TextEffects, and TextWrapping.


2 Answers

TextBlock is not editable. Use TextBox instead.

like image 112
Memoizer Avatar answered Oct 13 '22 04:10

Memoizer


you can use EditableTextBlock as shown in the link

like image 38
Vikram Avatar answered Oct 13 '22 06:10

Vikram