Export (0) Print
Expand All

PackagePart.ContentType Property

Gets the MIME type of the content stream.

Namespace: System.IO.Packaging
Assembly: WindowsBase (in windowsbase.dll)

public string ContentType { get; }
/** @property */
public String get_ContentType ()

public function get ContentType () : String

You cannot use this property in XAML.

Property Value

The MIME type of the content data stream for the part.

Exception typeCondition

InvalidOperationException

The part has been deleted.

-or-

The Package is not open (Dispose or Close has been called).

-or-

The string returned by the derived class GetContentTypeCore method is empty.

ContentType is a read-only property that can be accessed only when the parent Package is open.

The ContentType property is automatically set by the PackagePart constructor. After it is set by the constructor, the ContentType cannot be changed.

The ContentType property is a MIME type formed in accordance with the RFC 2616 Hypertext Transfer Protocol - HTTP, Section 3.7. The following table shows an example of the content MIME types used in XML Paper Specification (XPS) documents.

Description

Content Type

Font

application/vnd.ms-opentype

ICC profile

application/vnd.ms-color.iccprofile

JPEG image

image/jpeg

Obfuscated font

application/vnd.ms-package.obfuscated-opentype

PNG image

image/png

PrintTicket

application/vnd.ms-printing.printticket+xml

TIFF image

image/tiff

Windows Media Photo image

image/vnd.ms-photo

Windows 98, Windows Server 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

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

.NET Framework

Supported in: 3.0

Community Additions

ADD
Show:
© 2015 Microsoft