Can't edit Textblock content in WPF

26,317

Solution 1

TextBlock is not editable. Use TextBox instead.

Solution 2

you can use EditableTextBlock as shown in the link

Share:
26,317
Ortund
Author by

Ortund

I started teaching myself code around 2003 out of a high school computer course I was doing as a part of my curriculum. Very quickly I became filled with a sense of pride as I saw that the code I was writing was creating things so I decided to pursue this as a career. I had a few jobs developing software over the next 10 years during which time I'd learned a lot and developed my skills considerably. In 2013, however, I found myself without a job in an economic climate that didn't favor my prospects for re-employment. I had to find a way to make money fast. Having started my own software development business at that time, I managed to keep my head above water for a few years. In 2017 however, after a few personal setbacks, I decided to go back to the job market. I've since been working for a small software house where I develop and maintain solutions and bespoke data management systems for our clients on a regular basis. Most of these use ASP.NET Web Forms, but as I'm the only employee on staff with experience in MVC, I'm tasked with updating and maintaining all of our MVC properties as well.

Updated on January 30, 2020

Comments

  • Ortund
    Ortund over 4 years

    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.