alexa
menu

Blazor

  • Code Examples
  • Upgrade Guide
  • User Guide
  • Demos
  • Support
  • Forums
  • Download
Search Results for

    Show / Hide Table of Contents

    Class MediaDropEventArgs

    Provides information about the media drop event in a rich text editor.

    Inheritance
    object
    EventArgs
    MouseEventArgs
    DragEventArgs
    MediaDropEventArgs
    Inherited Members
    DragEventArgs.DataTransfer
    EventArgs.Empty
    MouseEventArgs.AltKey
    MouseEventArgs.Button
    MouseEventArgs.Buttons
    MouseEventArgs.ClientX
    MouseEventArgs.ClientY
    MouseEventArgs.CtrlKey
    MouseEventArgs.Detail
    MouseEventArgs.MetaKey
    MouseEventArgs.MovementX
    MouseEventArgs.MovementY
    MouseEventArgs.OffsetX
    MouseEventArgs.OffsetY
    MouseEventArgs.PageX
    MouseEventArgs.PageY
    MouseEventArgs.ScreenX
    MouseEventArgs.ScreenY
    MouseEventArgs.ShiftKey
    MouseEventArgs.Type
    object.Equals(object)
    object.Equals(object, object)
    object.GetHashCode()
    object.GetType()
    object.MemberwiseClone()
    object.ReferenceEquals(object, object)
    object.ToString()
    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 Image, Video, or Audio. The default value is null.

    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."); 
            } 
        } 
    }
    In this article
    Back to top Generated by DocFX
    Copyright © 2001 - 2025 Syncfusion Inc. All Rights Reserved