. NET Compact framework tips (2)-DataGrid Application

Source: Internet
Author: User

In WM ApplicationProgramYou must use the most powerful DataGrid. In. Net CF, The DataGrid has been completely weakened.

The following questions are some of the questions that many netizens have encountered during development. I would like to summarize them and hope to help you.

Note some details during actual development.

We may retrieve the data sources of n columns at a time, and some do not want to be displayed in DG. We can create a column first, and then set the mappingname of the specified column.
At this time, the column data corresponding to mappingname is not displayed.

How to Create a column header?
Create a datagridtablestyle by using the datagird tablestyle attribute.
Create more than one datagridcolumnstyle and specify its mappingname.
If mappingname cannot be found in the data source, it is not displayed (case sensitive)

Can I create only tablestyle?
Of course, you only need to specify the mappingname of tablestyle. If you do not create columnstyle, all columns in the data source will be bound.
Once columnstyle is created, it is displayed according to columnstyle. Even if columnstyle does not exist (all columns are not displayed ).

Why cannot I hide columns?
The column in The initird in. Net CF does not support the visiable attribute.
We only need to set its width attribute to 0 so that it is not displayed. (coincidentally)

Does the master-Details method be supported?
This method is not supported. We can implement it by ourselves, but the. net cf DataGrid itself does not.

How to obtain the current row and column?
Use columnnumber (column index subscript) and rownumber (row index subscript) of currentcell of the DataGrid object ).

How to drag columns in the DataGrid?
. Net CF certainly does not support pulling. Of course, we implement it by ourselves,

The following image example is used to hide a column.

Data Binding. Select a row.

See? We selected 5th rows and asked if we wanted to hide this row?

Have you seen it? The 2nd column is hidden, and the result is after the width is set to 0. You can pull the 2nd column from there.

CodeDownload:Devicetechdemo.rar

Running Environment: vs2008+ Wm6.0 +. Net cf3.5

Author: appleseeker (Feng)

Date: 2009-2-12

introduction: mobile development index

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.