This is a migrated thread and some comments may be shown as answers.

RadUploadDropPanel Managing

2 Answers 67 Views
Upload
This is a migrated thread and some comments may be shown as answers.
Carlos
Top achievements
Rank 2
Carlos asked on 10 Oct 2011, 06:02 PM
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 Answers, 1 is accepted

Sort by
0
Carlos
Top achievements
Rank 2
answered on 11 Oct 2011, 06:04 PM
Any help would be greatly apreciated.. I'm suffering here..
0
Alex Fidanov
Telerik team
answered on 13 Oct 2011, 01:56 PM
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 >>

Tags
Upload
Asked by
Carlos
Top achievements
Rank 2
Answers by
Carlos
Top achievements
Rank 2
Alex Fidanov
Telerik team
Share this question
or