Export (0) Print
Expand All

DocumentList Class

Represents a Pocket PC control for displaying and managing documents in a consistent way.

Namespace: Microsoft.WindowsCE.Forms
Assembly: Microsoft.WindowsCE.Forms (in microsoft.windowsce.forms.dll)

public class DocumentList : Control
public class DocumentList extends Control
public class DocumentList extends Control
Not applicable.

A DocumentList control provides a managed implementation of the native Windows CE DocList control, the control that is visible, for example, when you start Microsoft® Pocket Word and Microsoft® Pocket Excel. This control provides the following functionality:

  • Select, delete, copy, move, and rename files and folders.

  • Sort by a file name, date, or size.

  • E-mail files.

  • Send files by infrared to another device.

A DocumentList is a control rather then an entire dialog like such as FileDialog. Using a DocumentList control allows you include custom menus or other controls in your files selection UI.

A DocumentList should have the same width as the form on which it is placed. The length can be as long as needed.

A DocumentList only displays the files of a selected folder in the My Documents hierarchy.

The following code example creates a DocumentList control contained in a Panel.

using System;
using System.Drawing;
using System.Windows.Forms;
using Microsoft.WindowsCE.Forms;

public class Form1 : Form
{
    private DocumentList DocList;
    private StatusBar statusBar1;

    public Form1()
    {
        // Create an instance of a DocumentList control.
        DocList = new DocumentList();

        // Create an instance of the event handler delegate
        // using a reference to the OnDocActivated method,
        // which handles the DocumentActivated event.
        // Add the delegate instance to the DocumentActivated event.
        DocList.DocumentActivated +=
           new DocumentListEventHandler(this.OnDocActivated);

        // Create an instance of the event handler delegate
        // using a reference to the OnFolderSel method,
        // which handles the SelectedDirectoryChanged event.
        // Add the delegate instance to the
        // SelectedDirectoryChanged event.
        DocList.SelectedDirectoryChanged +=
           new EventHandler(this.OnFolderSel);

        // Create an instance of the event handler delegate
        // using a reference to the OnDelDoc method,
        // which handles the DeletingDocument event.
        // Add the delegate instance to the
        // DeletingDocument event.
        DocList.DeletingDocument +=
           new DocumentListEventHandler(this.OnDelDoc);

        DocList.Filter = " |*.*| |*.txt;*.xml| |*.pwi;*.pdt| " +
           "|*.pxl;*.psw| |*.jpg;*.gif;*.bmp| |*.wav;*.wmv;*.mpg;";
        DocList.FilterIndex = 0;
        DocList.SelectedDirectory = "Personal";

        statusBar1 = new StatusBar();
        statusBar1.Parent = this;
        DocList.Parent = this;
        this.Text = "DocList Demo";

        // Display the OK button for closing the application.
        this.MinimizeBox = false;
    }
    private void OnDelDoc(object obj, DocumentListEventArgs docg)
    {
        statusBar1.Text += "Deleted: " + docg.Path;

        // Add code to close any instances of the file.
    }
    private void OnDocActivated(object obj, DocumentListEventArgs docg)
    {
        statusBar1.Text = "Activated: " + docg.Path;

        // Add code to open the selected file.
    }
    private void OnFolderSel(object obj, EventArgs eventg)
    {
        statusBar1.Text = "Folder: " + DocList.SelectedDirectory;

        // Add code to access the selected folder to open and close files.
    }
    static void Main()
    {
        Application.Run(new Form1());
    }
}


System.Object
   System.MarshalByRefObject
     System.ComponentModel.Component
       System.Windows.Forms.Control
        Microsoft.WindowsCE.Forms.DocumentList

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

Windows Mobile for Pocket PC

The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

.NET Compact Framework

Supported in: 2.0

Community Additions

ADD
Show:
© 2015 Microsoft