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.
Defining an ImageMessage
ImageSource imageSource = new BitmapImage(new Uri("ms-appx:///MyImage.png", UriKind.Absolute));
ImageMessage imageMessage = new ImageMessage(this.currentAuthor, imageSource);
this.chat.AddMessage(imageMessage);
Furthermore, the ImageMessage
supports setting Stretch
and Size
for its image.
Setting the Stretch and Size of the message
ImageSource imageSource = new BitmapImage(new Uri("ms-appx:///MyImage.png", UriKind. Absolute));
ImageMessage imageMessage = new ImageMessage(this.currentAuthor, imageSource);
imageMessage.Stretch = Stretch.UniformToFill;
imageMessage.Size = new Windows.Foundation.Size(150, 100);
this.chat.AddMessage(imageMessage);