RadUploadDropPanel Managing

3 posts, 0 answers
  1. Carlos
    Carlos avatar
    50 posts
    Member since:
    Feb 2011

    Posted 10 Oct 2011 Link to this post

    Hi there.

    I'm using radUpload in several situtions, but now I face a request a bit different...

    I want to have a RadUploadDropPanel and manage the Drop action in MVVM:

    My xaml:

     <telerik:RadUploadDropPanel x:Name="radUploadPanel"
                                            BorderThickness="1" BorderBrush="Gray"  Background="Transparent"
                                            HorizontalAlignment="Stretch" VerticalAlignment="Top" Height="90"
                                            Grid.Row="0" Grid.Column="1">
                        <swi:Interaction.Triggers>
                            <!--<swi:EventTrigger EventName="Loaded">
                                <esi:CallDataMethod Method="radUploadPanel_Loaded"/>
                            </swi:EventTrigger>-->
                            <swi:EventTrigger EventName="DragEnter">
                                <esi:CallDataMethod Method="radUploadPanel_DragEnter"/>
                            </swi:EventTrigger>
                            <swi:EventTrigger EventName="DragLeave">
                                <esi:CallDataMethod Method="radUploadPanel_DragLeave"/>
                            </swi:EventTrigger>
                            <swi:EventTrigger EventName="Drop">
                                <esi:CallDataMethod Method="radUploadPanel_Drop"/>
                            </swi:EventTrigger>

                        </swi:Interaction.Triggers>
                    </telerik:RadUploadDropPanel>


    ..., in my View Model:

            public void radUploadPanel_Drop(object sender, DragEventArgs e)
            {
    //Code goes here...
            }

    can you please tell me how can I "grab" the file stream in order to submit it myself to a WebServer..

    Thanks in advance.

    Carlos Sampaio
  2. Carlos
    Carlos avatar
    50 posts
    Member since:
    Feb 2011

    Posted 11 Oct 2011 Link to this post

    Any help would be greatly apreciated.. I'm suffering here..
  3. DevCraft banner
  4. Alex Fidanov
    Admin
    Alex Fidanov avatar
    636 posts

    Posted 13 Oct 2011 Link to this post

    Hello Carlos,

    I am not sure why you need the upload panel for this. The RadUploadPanel is just a panel associated with the Upload control and it makes sense to use it only if you have an upload control. As you will be doing your custom uploading, you do not need this. The Drop event belongs to the UIElement class. You can get the FileInfo object when dropping a file using the following code:

    object droppedData = e.Data.GetData(System.Windows.DataFormats.FileDrop);
    System.IO.FileInfo[] droppedFiles = droppedData as System.IO.FileInfo[];
    if (droppedFiles != null)
    {
        foreach (FileInfo file in droppedFiles)
        {
            using (Stream stream = file.OpenRead())
            {
                ...
            }
        }
    }


    Best wishes,
    Alex Fidanov
    the Telerik team

    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

Back to Top