How to add media attachment button to a template?


Hello, 

I am using my own SfChat.AttachmentButtonTemplate that has custom buttons.
So here is my question: Is there a way I can add the Syncfusion Media attachment button that is usually shown when no AttachmentButtonTemplate is used and the ShowAttachmentButton  attribute is set to true.

Thanks


5 Replies 1 reply marked as answer

SS Sivaraman Sivagurunathan Syncfusion Team November 9, 2020 05:04 AM UTC

Hi Alaa, 

Thanks for using Syncfusion controls. 

We have checked your query. you can achieve your requirement by using AttachmentButtonTemplate.  You can load any view in that AttachmentButtonTemplate template. Please refer the following UG Link for more reference.  


Regards, 
Sivaraman S 



AS Alaa Serry November 9, 2020 02:56 PM UTC

Hi Sivaraman and thanks for your response 

I am already using AttachmentButtonTemplate. However, my question is how to be able to show the dialog to attach various types of media files as shown in this link 
https://www.syncfusion.com/blogs/post/load-more-messages-attach-and-send-images-and-media-show-interactive-cards-in-xamarin-chat-control.aspx#media-attachment-button 

Thanks.


SS Sivaraman Sivagurunathan Syncfusion Team November 10, 2020 04:48 AM UTC

Hi Alaa, 

We have checked your query, In that, we have use SfPopupLayout to show the various type of media files. when tap the attachment button. We have prepared the sample based on your requirement and attached for your reference you can download the same from below link. 


Regards, 
Sivaraman S 



AS Alaa Serry November 13, 2020 11:44 PM UTC

Thanks Sivaraman that was helpful.

By any chance do you have any other samples to add video and audio clips to hat messages.

Regards,
Alaa 


GS Gokul Saravanan Syncfusion Team November 16, 2020 12:06 PM UTC

Hi Alaa, 
 
Thanks for the update. 
 
We have checked your query. We does not have any demo samples with video and audio messages in Chat. We let you know that chat does not have default audio and video message type. You can create your own custom message type and set template for that. For that, you have to write the custom Interface and new custom message type from IMessage. And bind it to your custom view template. We have provided some code snippets, how to add audio message to your chat. 
 
public interface IAudioMessage : IMessage 
{ 
  string AudioPath 
   { 
      get; 
      set; 
   } 
} 
 
// Audio Message 
public class AudioMessage : TextMessage, IAudioMessage 
{ 
  public AudioMessage() 
   { 
   } 
 
   public string AudioPath 
   { 
      get; 
      set; 
   } 
} 
 
// Created Audio messages to add to chat messages 
private AudioMessage CreateAudioMessage(string text, Author auth, string audioPath) 
{ 
   return new AudioMessage() 
    { 
      Author = auth, 
      DateTime = new DateTime(2020, 3, 1, 7, 0, 0), 
      Text = text, 
      AudioPath=audioPath 
    }; 
} 
 
 
You can also refer our online user guide documentation regarding the creating custom template to your messages by the following link, 
 
We hope this helps. Please let us know, if you would require any further assistance 
 
Regards 
Gokul S 


Marked as answer
Loader.
Up arrow icon