Class MediaDropEventArgs
Provides information about the media drop event in a rich text editor.
Inherited Members
Namespace: Syncfusion.Blazor.RichTextEditor
Assembly: Syncfusion.Blazor.dll
Syntax
public class MediaDropEventArgs : DragEventArgs
Remarks
This class extends the DragEventArgs class to include additional properties specific to media drop events in a rich text editor.
It provides details about the drop range and cancellation behavior, allowing developers to handle media drop operations effectively.
Examples
@using Syncfusion.Blazor.RichTextEditor;
<SfRichTextEditor>
<RichTextEditorEvents OnMediaDrop="OnMediaDropHandler" />
</SfRichTextEditor>
@code {
public void OnMediaDropHandler(MediaDropEventArgs args)
{
if (args.MediaType == "Image")
{
Console.WriteLine("Image file drop detected.");
args.Cancel = true;
}
}
}
Constructors
MediaDropEventArgs()
Declaration
public MediaDropEventArgs()
Properties
Cancel
Gets or sets a value indicating whether the action should be prevented.
Declaration
public bool Cancel { get; set; }
Property Value
| Type | Description |
|---|---|
| bool | A bool indicating whether the drop action should be canceled. The default value is false. |
Remarks
Setting this property to true prevents the default drop behavior in the rich text editor.
This property is typically used in event handlers to control whether the media drop operation should proceed.
Examples
@using Syncfusion.Blazor.RichTextEditor;
<SfRichTextEditor>
<RichTextEditorEvents OnMediaDrop="OnMediaDropHandler" />
</SfRichTextEditor>
@code {
public void OnMediaDropHandler(MediaDropEventArgs args)
{
args.Cancel = true;
}
}
MediaType
Gets or sets the type of media being dropped.
Declaration
public string? MediaType { get; set; }
Property Value
| Type | Description |
|---|---|
| string | A string representing the type of media being dropped. Possible values are |
Remarks
This property specifies the type of media file being dropped into the rich text editor, allowing developers to apply specific validation or handling based on the media type.
If no media type is specified, this property returns null.
Examples
@using Syncfusion.Blazor.RichTextEditor;
<SfRichTextEditor>
<RichTextEditorEvents OnMediaDrop="OnMediaDropHandler" />
</SfRichTextEditor>
@code {
public void OnMediaDropHandler(MediaDropEventArgs args)
{
if (args.MediaType == "Audio")
{
Console.WriteLine("Audio file drop detected.");
}
else if (args.MediaType == null)
{
Console.WriteLine("No media type specified.");
}
}
}