File Attachment Properties

In XAF, the File Attachments Module provides the BLOB file attachment functionality.

The image below illustrates IFileData type business class properties.

Note

Refer to the Property Editors | File Attachment Properties section in the Feature Center demo installed with XAF to see File Attachment Property Editors in action. The Feature Center demo is installed in %PUBLIC%\Documents\DevExpress Demos 18.2\Components\eXpressApp Framework\FeatureCenter by default. The ASP.NET version of this demo is available online at http://demos.devexpress.com/XAF/FeatureCenter/.

Examples

WinForms Property Editors for File Attachment Properties

Each WinForms Property Editor has a control that displays a corresponding property in a Detail View, and a repository item that displays a property in a List Editor that supports in-place editing. Both the control and repository item are shown below.

FileDataPropertyEditor

Control: FileDataEdit - a ButtonEdit control descendant. The OpenFileDialog is used to attach a file.

Repository Item: RepositoryItemFileDataEdit - a descendant of the XtraEditors Library's RepositoryItemButtonEdit repository item.

Description:

Used for properties of the types that implement the IFileData interface by default. For instance, the FileData type is a built-in type that implements this interface.

This Property Editor is contained in the File Attachments Module. It is used when this module is added to a WinForms application.

The Open, SaveTo and ClearContent Actions, which you can perform with the editor, represent FileAttachmentController Actions. Use the editor's context menu to execute these Actions. Clicking the editor's button or pressing Enter also executes the Open Action.

ASP.NET Property Editors for File Attachment Properties

Each ASP.NET Property Editor has controls that display a property in a Detail View's View and Edit mode (see DetailView.ViewEditMode). These controls are listed below.

FileDataPropertyEditor

View mode control: FileDataEdit control which uses the HtmlAnchor control to download the current file in the view mode.

Edit mode control: FileDataEdit control which uses the HtmlAnchor control to download the current file and the ASPxUploadControl to upload a new file in the edit mode. The Change File and Clear buttons are displayed using two ASPxButton controls.

Description:

Used for properties of the types that implement the IFileData interface by default. For instance, the FileData type is a built-in type that implements this interface.

This Property Editor is contained in the File Attachments Module. It is used when this module is added to an ASP.NET application. The FileDataPropertyEditor uses only the FileDataEdit control, which is generated in differently for the view, edit, and read-only modes.

The file representing the property's value is displayed as a link and can be downloaded in the view mode. The Download operation represents the FileAttachmentController's Download Action. In an edit mode, the Edit and Clear operations are added to the download operation.

In the current implementation of the FileDataPropertyEditor, the upload progress is not shown in case the ImmediatePostDataAttribute is applied to the current FileData property or the IModelCommonMemberViewItem.ImmediatePostData option is enabled for the current View Item in Model Editor.

Mobile Property Editors for File Attachment Properties

Each Mobile Property Editor has widgets that display a property in a Detail View's View and Edit mode (see DetailView.ViewEditMode). These widgets are listed below.

MobileFileDataPropertyEditor

View mode widget: a widget that displays a hyperlink using the a HTML element.

Edit mode widget: a widget that displays a hyperlink using the a HTML element.

Description:

Used for properties of the types that implement the IFileData interface by default. For instance, the FileData type is a built-in type that implements this interface.

This Property Editor is contained in the File Attachments Module. It is used when this module is added to a Mobile application. The MobileFileDataPropertyEditor uses only the widget, which allows you to download the attached file.

Upload and delete are not available in the MobileFileDataPropertyEditor's current implementation.