Drag in a upload window

2 posts, 0 answers
  1. Tarcisis
    Tarcisis avatar
    29 posts
    Member since:
    Nov 2010

    Posted 24 Nov 2010 Link to this post

    I must do a dialog window to upload files in silverlight!

    My page(.xaml) is:
    UserControl xmlns:my="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Data.Input"  x:Class="SilverlightApplication1.MainPage"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
        xmlns:telerik="clr-namespace:Telerik.Windows.Controls;assembly=Telerik.Windows.Controls"
        xmlns:telerikInput="clr-namespace:Telerik.Windows.Controls;assembly=Telerik.Windows.Controls.Input"
        xmlns:telerikGridView="clr-namespace:Telerik.Windows.Controls;assembly=Telerik.Windows.Controls.GridView"
        xmlns:telerikNavigation="clr-namespace:Telerik.Windows.Controls;assembly=Telerik.Windows.Controls.Navigation"
        xmlns:telerikQuickStart="clr-namespace:Telerik.Windows.Controls.QuickStart;assembly=Telerik.Windows.Controls"
        d:DesignHeight="300" d:DesignWidth="400">


        
            <Grid x:Name="LayoutRoot" Width="320" Height="140">
            <Canvas Margin="8,8,0,0" Background="AliceBlue" Height="120" VerticalAlignment="Top" HorizontalAlignment="Left" Width="300">
                <Button Width="75" Canvas.Left="170" Canvas.Top="43" Content="Browse" x:Name="btnBrowse"  Click="btnBrowse_Click" />
                <TextBox Canvas.Left="25" IsReadOnly="True"  Canvas.Top="43" Text="TextBox" TextWrapping="Wrap" Width="145"   Name="txtFileName" />
                <ProgressBar Height="10" Width="220" Canvas.Left="25" Canvas.Top="89" x:Name="prgUpload" />
                
                <my:Label Content="Please select a file to upload"  Name="lblError" Canvas.Left="25" Canvas.Top="23" RenderTransformOrigin="0.133,-0.063" Width="220"/>
                <my:Label x:Name="lblProgress" Canvas.Left="25" Canvas.Top="69" RenderTransformOrigin="0.133,-0.063" Width="220"/>
                <Button Width="75" Canvas.Left="170" Canvas.Top="100" Content="Close" x:Name="close"  Click="close_Click" />
            </Canvas>
           
        </Grid>
    </UserControl>

    And i use a web service to upload the file.
    So far, so good...it works perfectly!!

    But now i want to add the functionality of drag(instead of click in button Browser to select the file), like the telerikInput:RadUploadDropPanel.


    The problem is: if i choose the <telerikInput:RadUploadDropPanel  to add this functionality, i must use the <telerikInput:RadUpload to upload the file, and the <telerikInput:RadUpload must use a Handler to upload the file, and i can´t use a handler.I must use a web service.
    There´s anybody knows something about this?!?Can i use a web service instead of a handle in telerikInput:RadUpload?and how?

    I tried to do something like this:

        <telerikInput:RadUploadDropPanel  DragEnter="RadUploadDropPanel1_DragEnter" DragLeave="RadUploadDropPanel_DragLeave" x:Name="RadUploadDropPanel1" RadUpload="{Binding ElementName=btnBrowse}">
           
           <Grid x:Name="LayoutRoot" Width="320" Height="140">
            <Canvas Margin="8,8,0,0" Background="AliceBlue" Height="120" VerticalAlignment="Top" HorizontalAlignment="Left" Width="300">
                <Button Width="75" Canvas.Left="170" Canvas.Top="43" Content="Browse" x:Name="btnBrowse"  Click="btnBrowse_Click" />
                <TextBox Canvas.Left="25" IsReadOnly="True"  Canvas.Top="43" Text="TextBox" TextWrapping="Wrap" Width="145"   Name="txtFileName" />
                <ProgressBar Height="10" Width="220" Canvas.Left="25" Canvas.Top="89" x:Name="prgUpload" />
                
                <my:Label Content="Please select a file to upload"  Name="lblError" Canvas.Left="25" Canvas.Top="23" RenderTransformOrigin="0.133,-0.063" Width="220"/>
                <my:Label x:Name="lblProgress" Canvas.Left="25" Canvas.Top="69" RenderTransformOrigin="0.133,-0.063" Width="220"/>
                <Button Width="75" Canvas.Left="170" Canvas.Top="100" Content="Close" x:Name="close"  Click="close_Click" />
            </Canvas>
        </Grid>
        
       </telerikInput:RadUploadDropPanel>

    but of course, it doesnt work.
  2. Alex Fidanov
    Admin
    Alex Fidanov avatar
    636 posts

    Posted 25 Nov 2010 Link to this post

    Hello Tarcisis,

    Have you tried setting the AllowDrop property of the UIElement that you wish to drop over to true and handling its Drop event? Basically, this is how drag-drop is implemented and this is what the RadUploadDropPanel is using.

    Best wishes,
    Alex Fidanov
    the Telerik team
    Browse the videos here>> to help you get started with RadControls for Silverlight
  3. DevCraft banner
Back to Top