[Original] solutions and ideas for "the data items are inexplicably cleared when cells in the DataGrid are dynamically bound to ComboBox in Silverlight are clicked ., Datagridcombobox

Source: Internet
Author: User

[Original] solutions and ideas for "the data items are inexplicably cleared when cells in the DataGrid are dynamically bound to ComboBox in Silverlight are clicked ., Datagridcombobox

I encountered a strange problem at work today. After half a day, I did not find the reason. In this case, a ComboBox column is bound to the Datagrid, which is not included in the model data, but independently bound from the database in the LoadingRow event.

After the binding is successful, but when you edit the cell (that is, click ComboBox), the content in ComboBox is instantly cleared.

 

After checking the datagrid events bound to the front-end, there are not many events in which the ComboBox is cleared, so we found the most suspect event "CurrentCellChanged ",

The Code is as follows:

Private void dataGriddoc_CurrentCellChanged (object sender, EventArgs e) {var dgGrid = sender as DataGrid; if (dgGrid! = Null) dgGrid. BeginEdit ();}

Although the operation on ComboBox is not displayed in the event, the code in the event is blocked and the problem is solved. This issue needs to be decompiled and analyzed to find out what the dgGrid. BeginEdit operation has done.

 

Solution:

 

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.