Image Message

The usage of the ImageMessage is similar to the one of the GifMessage. The difference is that instead of passing a Uri source, the constructor accepts an Image source.

  • Author author
  • ImageSource source
  • DateTime creationDate

Example 1: Defining an ImageMessage

 ImageMessage imageMessage = 
            new ImageMessage(this.currentAuthor, new BitmapImage(new Uri("/Images/dog.jpeg", UriKind.RelativeOrAbsolute))); 
 
this.chat.AddMessage(imageMessage); 

Figure 1: Defining ImageMessage

Defining ImageMessage

Furthermore, the ImageMessage supports setting Stretch and Size for its image.

Example 2: Setting the Stretch and Size of the message

ImageMessage imageMessage = 
            new ImageMessage(this.currentAuthor, new BitmapImage(new Uri("/Images/dog.jpeg", UriKind.RelativeOrAbsolute))); 
 
        imageMessage.Stretch = Stretch.Fill; 
        imageMessage.Size = new Size(150, 90); 
 
this.chat.AddMessage(imageMessage); 

Figure 2: Defining ImageMessage with Stretch and Size

Defining ImageMessage

See Also

In this article
Not finding the help you need? Improve this article