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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T05:18:25+00:00 2026-05-24T05:18:25+00:00

I have a Silverlight datagrid that allows the use to enter in how many

  • 0

I have a Silverlight datagrid that allows the use to enter in how many of a product that you plan to order. Already populated is he cost of the item. Right now I have an event that once you finish editing t he a cell it checks that header, but how do I multiply those two cells and place the value in a cell in the cost column. I know I would really be changing the List of the objects that is bound to my datagrid but I don’t know how to do this.

 client.GetOrderCompleted += (s, ea) =>
        {
            dgOrder.AutoGenerateColumns = false;
            //dgOrder.ColumnWidth.Value = 100;





            dgOrder.Columns.Add(CreateTextColumn("SKU", "SKU"));
            dgOrder.Columns.Add(CreateTextColumn("productname", "Product Name"));
            dgOrder.Columns.Add(CreateTextColumn("itemnumber", "Item Number"));
            dgOrder.Columns.Add(CreateTextColumn("cost", "Cost"));
            dgOrder.Columns.Add(CreateTextColumn("asin", "ASIN"));
            dgOrder.Columns.Add(CreateTextColumn("pendingorder", "Rank"));
            dgOrder.Columns.Add(CreateTextColumn("rank", "Node"));
            //dgOrder.Columns.Add(CreateTextColumn("w4", "AMZN"));
            dgOrder.Columns.Add(CreateTextColumn("amazon", "AMZN"));
            dgOrder.Columns.Add(CreateTextColumn("ourprice", "OurPrice"));
            dgOrder.Columns.Add(CreateTextColumn("bbprice", "BuyBox"));
            dgOrder.Columns.Add(CreateTextColumn("afner", "AFN"));
            dgOrder.Columns.Add(CreateTextColumn("quantity", "INV"));
            dgOrder.Columns.Add(CreateTextColumn("w4", "W4"));
            dgOrder.Columns.Add(CreateTextColumn("w3", "W3"));
            dgOrder.Columns.Add(CreateTextColumn("w2", "W2"));
            dgOrder.Columns.Add(CreateTextColumn("w1", "W1"));
            dgOrder.Columns.Add(CreateTextColumn("order", "Order"));
            dgOrder.Columns.Add(CreateTextColumn("total", "Total"));
            dgOrder.Columns.Add(CreateTextColumn("profit", "Profit"));
            dgOrder.Columns.Add(CreateTextColumn("percent", "Percent"));
            dgOrder.Columns.Add(CreateHyperlink("asin"));
            dgOrder.ItemsSource = ea.Result;
            Original = ea.Result;

        };
    client.GetOrderAsync(txtBox.Text);

XAML:

<sdk:DataGrid AutoGenerateColumns="True" 
      Height="469" 
      HorizontalAlignment="Left" 
      Margin="12,41,0,0" 
      Name="dgOrder" 
      VerticalAlignment="Top" 
      Width="1316" 
      HeadersVisibility="All" 
      CellEditEnded="dgOrder_CellEditEnded" 
      RowBackground="DodgerBlue" 
      AlternatingRowBackground="LightBlue"
      LostFocus="TextBox_LostFocus" 
      BeginningEdit="dgOrder_BeginningEdit" 
      SelectionChanged="dgOrder_SelectionChanged"
      LoadingRow="dgOrder_LoadingRow" />
  • 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-24T05:18:26+00:00Added an answer on May 24, 2026 at 5:18 am

    You could modify the object bound to your datagrid and include a property for the total cost. For example, assuming that your DataGrid is bound to an IList you can add a new TotalCost property:

    public class ItemOrder
    {
        public double TotalCost
        {
            get
            {
                return this.OrderAmount * this.ItemCost;
            }
        }
    
        // rest of your class
    }
    

    Alternatively, you could use a value converter to display the total cost:

    <DataGrid>
        <DataGrid.Resources>
            <TotalCostConverter x:Key="TotalCostConverter"/>
        </DataGrid.Resources>
        <DataGrid.Columns>
            <DataGridTextColumn Header="Amount" Binding="{Binding OrderAmount}"/>
            <DataGridTextColumn Header="ItemCost" Binding="{Binding ItemCost}"/>
            <DataGridTextColumn Header="Total" Binding="{Binding Converter={StaticResource TotalCostConverter}"/>
        </DataGrid.Columns>
    </DataGrid>
    
    
    //Converter
    public class TotalCostConverter : IValueConverter
    {
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            var itemOrder = value as ItemOrder;
            return itemOrder.OrderAmount * itemOrder.ItemCost;
        }
    
        public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
        {
            throw new NotImplementedException();
        }
    }
    

    Edit: After looking at your code, you can add a new column to the data grid binded to your ItemOrder object and attatch the value converter to it.

    dgOrder.Columns.Add(
        new DataGridTextColumn()
        { 
            Header = "Total",
            Binding = new Binding() 
            {
                //The Value converter described above
                Converter = new TotalCostConverter(),             
            }
        }        
    
    );
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a Silverlight DataGrid that's being populated with different types of data for
I have a Silverlight DataGrid that contains a single template column which displays a
I have a Silverlight 2.0 DataGrid that contains a list of items that needs
I have followed this tutorial which allowed me to create a Silverlight DataGrid that
I have a Silverlight application that is using a DataGrid. Inside of that DataGrid
I am working in a Silverlight 4 application. I have a datagrid that I
I have found that datagrid columns can be dynamically created and bound in Silverlight.
I have a Silverlight 4 application that uses a DataGrid. This DataGrid is bound
So I have a datagrid in Silverlight that is bound to a WCF that
I have a Silverlight DataGrid that contains a RowDetailsTemplate. The RowDetailsTemplate contains a TabControl

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.