Share via


NewItemFactory.GetImageStream Method

Gets an image for the specified Type that can be used as an icon in the collection editor or sub-property editor.

Namespace:  Microsoft.Windows.Design.PropertyEditing
Assembly:  Microsoft.Windows.Design.Interaction (in Microsoft.Windows.Design.Interaction.dll)

Syntax

'Declaration
Public Overridable Function GetImageStream ( _
    type As Type, _
    desiredSize As Size, _
    <OutAttribute> ByRef imageName As String _
) As Stream
public virtual Stream GetImageStream(
    Type type,
    Size desiredSize,
    out string imageName
)
public:
virtual Stream^ GetImageStream(
    Type^ type, 
    Size desiredSize, 
    [OutAttribute] String^% imageName
)
abstract GetImageStream : 
        type:Type * 
        desiredSize:Size * 
        imageName:string byref -> Stream 
override GetImageStream : 
        type:Type * 
        desiredSize:Size * 
        imageName:string byref -> Stream 
public function GetImageStream(
    type : Type, 
    desiredSize : Size, 
    imageName : String
) : Stream

Parameters

  • imageName
    Type: System.String%
    The name of the image that was found.

Return Value

Type: System.IO.Stream
A Stream that represents an image to display for type.

Exceptions

Exception Condition
ArgumentNullException

type is nulla null reference (Nothing in Visual Basic).

Remarks

This method searches for embedded resources in the same assembly as the control.

If multiple images are available for type, this method retrieves the image that is closest to desiredSize. This method is not guaranteed to return an image that matches desiredSize exactly.

The object returned by this method can be set as the Content property of a ContentControl.

The default implementation of this method searches for images that are named Namespace.ControlName.Icon.Extension.

Currently, only the following extensions are recognized:

  • .png

  • .bmp

  • .gif

  • .jpg

  • .jpeg

.NET Framework Security

See Also

Reference

NewItemFactory Class

Microsoft.Windows.Design.PropertyEditing Namespace

Other Resources

WPF Designer Extensibility