New to Telerik UI for WinUI? Download free 30-day trial

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); 
RadChat with an ImageMessage

RadChat with an 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); 
ImageMessage with Stretch and Size

ImageMessage with Stretch and Size

In this article
Not finding the help you need?