Silverlight DataGrid Real-time computing

Source: Internet
Author: User
Tags silverlight

In the enterprise application development process, we often have this demand: The program can calculate the tabular data, as far as possible to get the program to do, it is not difficult, it is difficult to try to improve the degree of human nature of the program, need to automatically calculate, that is, what is known as income.

In fact, this implementation is relatively simple, the main thing is to get the data of the currently selected row. The specific code is as follows:

XAML section:

<sdk:datagridtemplatecolumn header="Tax Income"> <sdk:DataGridTemplateColumn.CellTemplate> &lt ;D atatemplate> <textblock margin="2"Verticalalignment="Center"Horizontalalignment=" Left"text="{Binding NSSR}"Width=" -"/> </DataTemplate> </sdk:datagridtemplatecol Umn.                                    Celltemplate> <sdk:DataGridTemplateColumn.CellEditingTemplate> <DataTemplate> <textbox height=" -"Name="NSSR"text="{Binding PATH=NSSR, mode=twoway}"Width=" the"Textchanged="nssr_textchanged"></TextBox> </DataTemplate> </sdk:DataGridTemplateColumn.CellEditingTemplate> </sdk:datag Ridtemplatecolumn>
View Code

Background cs Section:

        #regionChange in tax income valuePrivate voidNssr_textchanged (Objectsender, Textchangedeventargs e) {JXS_GSSR= This. Dg_sourcegssrxx.selecteditem asJxs_gssrxxinfo;//get information on a click lineTextBox AA= Sender asTextBox; if(Isnumber (AA. Text))//verifies whether the input is a number{Decimal bb= (aa. Text = =""?0: Convert.todecimal (aa.            Text)); if(BB! =0) {Decimal temp= Convert.todecimal (JXS_GSSR.BBSR-BB)/BB; Jxs_gssr.bbccns= Math.Round (temp,3);//effect rendering, calculated in the BLL layer            }            }        }        #endregion
View Code

Relatively simple, just a simple study record.

Silverlight DataGrid Real-time computing

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.