Custom Document Icons

Using an Image as a Custom Document Type Icon in Xamarin.iOS.

PDF for offline use
Sample Code:
Related Articles:
Related SDKs:

Let us know how you feel about this

Translation Quality


last updated: 2017-05

This article covers including and managing an image asset in a Xamarin.iOS app to be used as a Custom Document Type Icon.

If a Xamarin.iOS app supports loading a particular document type, the developer can provide icons that the system will use when it encounters that document type, such as when a user holds down an attachment in the Mail Application as shown here:

The developer can add document type information for a file format the app is capable of opening by including dictionary entries for the CFBundleTypeName string and LSItemContentTypes array in the app's Info.plist. The icons for the document type go in the CFBundleTypeIconFiles array. If a document icon isn't provided, iOS will derive one from the app icon. Icons can be supplied for several sizes, optimized for the various device resolutions.

To assign these values in Visual Studio for Mac, use the Document Types section under the Advanced tab on the Info.plist editor to add the document type and assign image icons to it. For example, here is a screenshot showing registration for PDF support:

To assign these values in Visual Studio, use the Document Types section under the Advanced tab on the Info.plist:

Click the Add Document Type button and fill in the required fields:

For more information about document types, see Apple’s Uniform Type Identifiers Reference and Document Interaction Programming Topics for iOS.

Xamarin Workbook

If it's not already installed, install the Xamarin Workbooks app first. The workbook file should download automatically, but if it doesn't, just click to start the workbook download manually.