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 755391
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T15:07:29+00:00 2026-05-14T15:07:29+00:00

I have a datagrid like this: <dg:DataGrid Name=dg AutoGenerateColumns=False CanUserDeleteRows=True> <dg:DataGrid.Columns> <dg:DataGridTextColumn Header=Product Code

  • 0

I have a datagrid like this:

<dg:DataGrid Name="dg" AutoGenerateColumns="False" CanUserDeleteRows="True">
                    <dg:DataGrid.Columns>
                        <dg:DataGridTextColumn Header="Product Code" x:Name="columnProductCode" Binding="{Binding Path=Product.ProductCode}" IsReadOnly="True" ></dg:DataGridTextColumn>
                        <dg:DataGridTextColumn Header="Product Name" x:Name="columnProductName" Binding="{Binding Path=Product.Name}" IsReadOnly="True" ></dg:DataGridTextColumn>
                        <dg:DataGridTextColumn Header="ProductMeasure" x:Name="columnDonViTinh" Binding="{Binding Path=Product.Measure IsReadOnly="True"></dg:DataGridTextColumn>
                        <dg:DataGridTextColumn Header="Quantity" x:Name="ColumnQuantity" Binding="{Binding Path=Quantity IsReadOnly="False"></dg:DataGridTextColumn>
                    </dg:DataGrid.Columns>
</dg:DataGrid>

In the behind code, I have a struct like this:

private struct ProductDetail
        {

            public TProduct Product { get; set ; } // TProduct is a class provied by a web service
            public int Quantity { get; set; }
        }

and a List like this:

        private IList<ProductDetail> bs = new List<ProductDetail>();

I had tried to fill data to “bs”. And binding like this:

this.dg.ItemsSource = this.bs;

Everything is ok. I can insert a new row, delete row, but when I try to modified the column Quantity then click on the header of the datagrid (to resort) –> the Quantity column change to it is before.

How can I fix this problem.
Thanks advanced.

  • 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-05-14T15:07:29+00:00Added an answer on May 14, 2026 at 3:07 pm

    OK, I have try to define a class (with TProduct and Quantity attribute also) instead of the current struct. And .. it works =.=

    private class ProductDetail
    {
        public TProduct Product { get; set ; } // TProduct is a class provied by a web service
        public int Quantity { get; set; }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a DataGrid that is setup like this: <DataGrid AutoGenerateColumns=True GridLinesVisibility=Horizontal IsReadOnly=True ItemsSource={Binding
I have a DataGrid with info like this: Associate Amount Time Customer John Doe
I have this DataGrid: <mx:DataGrid id=myDataGrid> <mx:columns> <mx:DataGridColumn dataField=colA headerText=Column A: width=40 headerRenderer=path.customComponents.VerticalHeader itemRenderer=path.customComponents.CustomDataGridItemRenderer
I have a datagrid: <mx:DataGrid id=resultsDataGrid height=328 width=604 paddingRight=0 editable=false y=43 horizontalCenter=0> <mx:columns> <mx:DataGridColumn
I have a WPF 4.0 DataGrid with AutoGenerated columns. I would like to only
I feel like I'm missing something here, but I have this datagrid which when
I have a DataGrid where each column has a SortExpression. I would like the
I have a DataGrid with 5 template columns, However when I try and add
Using .NET 1.1, I have a DataGrid that contains three columns for each row.
I have a datagrid in a WPF populated from a csv file. This is

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.