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
- type
Type: System.Type
The type to get an image for.
- desiredSize
Type: System.Windows.Size
The requested size of the image.
- 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
- Full trust for the immediate caller. This member cannot be used by partially trusted code. For more information, see Using Libraries from Partially Trusted Code.
See Also
Reference
Microsoft.Windows.Design.PropertyEditing Namespace