DEVBUZZ Homepage Developing Preview/Detail Forms using the New Advanced .NET CF Controls
 
Web www.devbuzz.com
  HOME PAGE
  All Articles
  Advertise
  Consulting

 Development
  Discuss - Forums
  Still in the box?
  .Compact Framework
  Code Snippets
  SQL Server CE
  Database
  MS Resources
 Stores
  Developer Controls
  Pocket PC Hardware
  Pocket PC Software
  Pocket PC Books
  .NET CF Books
  Book Reviews
  SPB SW Discounts
  RESCO SW Discounts
 DEVBUZZ Info
  About Us
  Help
  Join our email list
  Links & Ratings
  Press & Comments
  Pocket PC version
  Software Reviews
  Hardware Reviews
 Authors
  Authors
  Article Guide
  Competitions
 Resources
  Developers
  Register
  Login

  SPB Discounts!
 Columnists
  Rick Winscot
 Past Blast
  Personal Media Ctr
  Gizmobility
  eVB Legacy
  Old news
  Hosted Software
  Wireless
  Newsletters
  Carl Davis
  Upton Au

 Pocket PC Registry
  Join the registry
  View current list
 Current Poll
Are you converting to .NET Compact Framework?
Yes, it has changed my life!
No, I'm sticking with eVB
.NET CF what's that`?

Current results
3431 votes so far
 Recent Forum Threads [goto forums]

Get Computername
read... (67 hits)


Great aid to development productivity
read... (82 hits)


ThreadingTimer sample code
read... (143 hits)


Multithreading with .NET CF
read... (194 hits)


Moving from eMbedded Visual Basic to Visual Basic .NET
read... (166 hits)


.NET Compact Framework 2.0 Service Pack 2
read... (226 hits)


Transfer Data from SQL Server 2000 to SQL Server Compact Edition
read... (298 hits)


This protocol version is not supported
read... (236 hits)


Converting Lowercase to uppercase wont work
read... (203 hits)


Direct access to MS SQL Server 2000
read... (374 hits)


Creating SDF file in Desktop
read... (513 hits)


Winsock in CF.NET
read... (316 hits)


Using Pocket Outlook to submit HTML page form with MAILTO action
read... (420 hits)


Missing file "System.Data.PocketPC.asmmeta.dll"
read... (268 hits)


HP iPAQ hw6915 Serial Port Issue
read... (309 hits)


Info on the recent forum changes
read... (341 hits)


SqlServer tools from Redgate
read... (383 hits)


Arrow keys and Hardware navigation button
read... (393 hits)


O2 XDA lls pin sync cable to comport
read... (322 hits)


Creating dynamic folders on Pocket PC OS
read... (299 hits)

Custom Windows Mobile software development.
LBS Challenge 2007
LBS Challenge Eight previous NAVTEQ Global LBS Challenge® participants have received venture capital funding and nine past LBS Challenge winners have launched commercial applications on major wireless carriers. Register your non-commercial LBS application in the 2007 NAVTEQ Global LBS Challenge in one of three regions: Americas, Europe-Middle East-Africa (EMEA) or Asia-Pacific(APAC). You could win a share of $2 million in prizes. This could be your year.
Dream. Develop. Win.

Development | .NET Compact Framework

Developing Preview/Detail Forms using the New Advanced .NET CF Controls
Written by Radomir Vozar  [author's bio]  [read 49709 times]
Edited by Derek

Download the code   Discuss this article   .NET Compact Framework   

Page 1  Page 2 

Developing Preview/Detail Forms using the New Advanced .NET CF Controls.

Most developers who have been developing their applications for mobile devices are in a situation when they must consider a changeover from the old known eVB developer tool to the new .NET Compact Framework environment. At the first glance the .NET CF supports everything that is necessary to build a robust mobile database solution displaying data in different Windows controls. The problem is that many of these controls haven’t been designed explicitly for mobile devices and that’s why they aren’t suitable for use in every situation.

In this article I would like to present an alternative way of creating preview and detail forms using third party .NET CF components named AdvancedList and DetailView (update: now part of the Resco's Mobile Forms Toolkit).

One of the main benefits of these components is their native mobile design similar to that of the Pocket PC PIM applications (e.g. Inbox, Calendar, Contacts, ).

Another major advantage is that they are easy to set-up in the Visual Studio Designer and they comprise native support connecting to SQLCE databases, which significantly decreases the necessary development time. This way you can easily create robust, colorful and database-linked forms just by clicking the property grid in the Visual Studio Designer and writing a few lines of code to load the data.

AdvancedList a Substitution for ListView and DataGrid.

The AdvancedList control is a substitute for the traditional ListView and DataGrid controls which makes more efficient use of the small display of mobile devices. Each row of the list is divided into several cells, which can be freely located within the row. Individual cells can include text, graphic or hyperlink. Every row can be of different height, so if there is a need to display more data in one row, it can be conveniently divided into several sub-rows. This technology allows you to display data in a legible form without the need to use a horizontal scrollbar, which is convenient especially for mobile devices.

The main feature of the control is the Row Template. Each Row Template defines the style to display the data in a row. It is possible to specify several different templates for every AdvancedList in a project. This provides the option of displaying different data in different ways depending on its character. This way you can define for example a more detailed view of the selected rows, or use the component as a Master-Details control, where master rows have a completely different look from the detail rows.

In addition the AdvancedList natively supports connection to SQL CE databases through its DBConnector property. Thanks to this feature, it is extremely easy to set up the entire component in the design mode. You only need one row of source code to load data into the list and you are finished!

The following picture shows the AdvancedList control displaying a list of customers in preview style, while the selected row uses a different style to display more detailed information about the selected customer.

Resco Grid Control

Although the above example may look quite complex, most of the work has been done in VS .NET Designer by defining three different templates. The first one for the header row, the second one for the preview style and the third, more detailed one, for the selected customer. Each template defines appropriate data mapping for every cell. You only need to enter three lines of code to load the data using DBConnector.

'setting the ConnectionString to the NorthWind SQLCE database
AdvancedList1.DbConnector.ConnectionString = _
               "Data Source = \Program Files\DevbuzzSample\Northwind.sdf;"

'setting the CommandText
AdvancedList1.DbConnector.CommandText = "SELECT * FROM customers"

'loading data with the DbConnector
AdvancedList1.LoadData()

As you can see on the AdvancedList image above the control has yet another unique feature. Its the ability to display different kinds of cells like hyperlinks and graphics. In addition to these cell types the control also provides the corresponding events, which can be used to perform an appropriate action when the user clicks a hyperlink or a graphics. So if he or she taps e.g. an e-mail address, the application immediately displays a new message dialog box. Or if a user taps the customer name link, the application displays a customer details form.

Private Sub AdvancedList1_LinkClick(ByVal sender As Object,
     ByVal e As Resco.Controls.LinkEventArgs) Handles AdvancedList1.LinkClick

     ' Handle the link click event
     If e.DataRow.CurrentTemplateIndex = 2 Then
         Select Case e.CellIndex
             Case 0 ' Customer Name
                 ' Show detail form of the selected customer
                 ShowCustomerDetail()

             Case 8 ' E-mail
                 ' Run New Message dialog
                 CreateProcess("iexplore", "MailTo:" & e.Target, IntPtr.Zero,
                     IntPtr.Zero, False, 0, IntPtr.Zero, IntPtr.Zero,
                     IntPtr.Zero, IntPtr.Zero)

         End Select
     End If
End Sub

Next Page 

Back to .NET Compact Framework | [Article Index]

 

Back to the top of the page.
Chris De Herrera's Windows CE Website Windows CE News & Information Source
Copyright ©2000-2007 by DEVBUZZ.COM, Inc., NJ. USA.MSDEVELOP