Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8837855
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T09:50:05+00:00 2026-06-14T09:50:05+00:00

My ObservableCollection has three items, and the rows are consistently shown in the datagrid.

  • 0

My ObservableCollection has three items, and the rows are consistently shown in the datagrid.
I cannot turn into edit mode a single cell of my DataGrid. I tried click, click-click, double-click, F2,…, but the whole row stay selected. How can I let the user edit the datagrid.
I found similar datagrid edit-questions in other posts but no-one solved my problem. Here is the code (WPF NetFramework 4.5). Pursposely, only the first column is non-editable (readonly).

<DataGrid Name="myDataGrid" Grid.Row="2" AutoGenerateColumns="False" ItemsSource="{Binding}" IsReadOnly="False">
    <DataGrid.Columns>
        <DataGridTemplateColumn Header="name" IsReadOnly="True" Width="200"  >
            <DataGridTemplateColumn.CellTemplate>
                <DataTemplate>
                    <TextBlock Text="{Binding Name}"/>
                </DataTemplate>
            </DataGridTemplateColumn.CellTemplate>
        </DataGridTemplateColumn>
        <DataGridTemplateColumn Header="Formulation" Width="100" IsReadOnly="False">
            <DataGridTemplateColumn.CellTemplate>
                <DataTemplate>
                    <TextBlock Text="{Binding FormulationStr}" />
                </DataTemplate>
            </DataGridTemplateColumn.CellTemplate>
            <DataGridTemplateColumn.CellEditingTemplate>
                <DataTemplate>
                    <TextBlock Text="{Binding FormulationStr}" />
                </DataTemplate>
            </DataGridTemplateColumn.CellEditingTemplate>
        </DataGridTemplateColumn>
        <DataGridTemplateColumn Header="volume Diff" Width="100" IsReadOnly="False">
            <DataGridTemplateColumn.CellTemplate>
                <DataTemplate>
                    <TextBlock Text="{Binding volumeDiff}" />
                </DataTemplate>
            </DataGridTemplateColumn.CellTemplate>
            <DataGridTemplateColumn.CellEditingTemplate>
                <DataTemplate>
                    <TextBlock Text="{Binding volumeDiff}" />
                </DataTemplate>
            </DataGridTemplateColumn.CellEditingTemplate>
        </DataGridTemplateColumn>
    </DataGrid.Columns>
</DataGrid>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T09:50:06+00:00Added an answer on June 14, 2026 at 9:50 am

    You have placed TextBlock in cell template as well as in cell editing template. That’s why you are not noticing any change on pressing F2 and double-clicking the cell since no matter what it will always be TextBlock which you can’t edit.

    Either placed TextBox in your CellEditingTemplate like this –

    <DataGridTemplateColumn Header="Formulation" Width="100" IsReadOnly="False">
        <DataGridTemplateColumn.CellTemplate>
            <DataTemplate>
                <TextBlock Text="{Binding FormulationStr}" />
            </DataTemplate>
        </DataGridTemplateColumn.CellTemplate>
        <DataGridTemplateColumn.CellEditingTemplate>
            <DataTemplate>
                <TextBox Text="{Binding FormulationStr}" />
            </DataTemplate>
        </DataGridTemplateColumn.CellEditingTemplate>
    </DataGridTemplateColumn>
    

    Or either simply use the DataGridTextColumn in place of DataGridTemplateColumn which internally provides the support what are you trying to achive by the above code –

    <DataGridTextColumn Header="Formulation" Width="100" IsReadOnly="False" Binding="{Binding FormulationStr}" />
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an ObservableCollection<T> . T has a ToString() method. What I'd like to
I have an ObservableCollection of Task objects. Each Task has the following properties: AssignedTo
I have a combobox which has ItemsSource set to an ObservableCollection property called DATA
My application has two lists public ObservableCollection<StreamItemViewModel> SearchStreamItems { get; private set; } public
I have an ObservableCollection of items that is bound to a list control in
I have an observable collection ie Owners and that collection has child items ie
Scenario: A ListView is DataBound to an ObservableCollection<CustomClass> and is displaying it's items through
The situation is like this: I have an Observable Collection that has a bunch
I have an ObservableCollection of addresses that I am binding to a ListBox. Then
I am using ObservableCollection as an ItemSource for my listBox component: But the behavior

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.