wpfSupporting Video Streaming and Pixel Array Assignment to an Image Control


Parameters

ParametersDetails
PixelHeight (System.Int32)The height of the image in units of image pixels
PixelWidth (System.Int32)The width of the image in units of image pixels
PixelFormat (System.Windows.Media.PixelFormat)The width of the image in units of image pixels
PixelsAnything which implements IList<T>- including the C# byte array
DpiXSpecifies the horizontal Dpi - Optional
DpiYSpecifies the vertical Dpi - Optional

Remarks

  • Make sure to reference the System.Windows.Interactivity assembly, so that the XAML Parser will recognize the xmlns:i declaration.
  • Note that the xmlns:b statement matches the namespace where the behavior implementation resides
  • Example assumes working knowledge of binding expressions and XAML.
  • This behavior supports assigning pixels to an image in the form of a byte array - even though the Dependency Property type is specified as an IList. This works since the C# byte array implements the IList
  • interface.
  • Behavior achieves very high performance, and can be used for Video Streaming
  • Do not assign the image's Source Dependency Property- bind to the Pixels Dependency Property instead
  • The Pixels, PixelWidth, PixelHeight and PixelFormat properties must be assigned for the pixels to be rendered
  • Order of Dependency Property assignment does not matter