Dear Sir/Madam
Because of issues mentioned in another post, I need to create a Remove button on the Silverlight Upload control, which can delete the file after it has been uploaded. The Silverlight control cannot directly delete files from the disk so I will have to call the handler and ask it to make the deletion.
I have written this in the MainPage.xaml stackpanel:
<StackPanel HorizontalAlignment="Right" Margin="3" Orientation="Horizontal" VerticalAlignment="Center" Name="stckpnl1">
[...]
<telerik:RadButton x:Name="RemoveButton" Click="btnRemove_Click" Margin="5" Padding="15 3" telerik:LocalizationManager.ResourceKey="UploadCancel" telerik:StyleManager.Theme="{StaticResource Theme}" Visibility="Collapsed" ToolTipService.ToolTip="Remove" Content="Remove"/>
[...]
</StackPanel>
In the same file, I show the button like this:
<VisualState x:Name="Uploaded">
<Storyboard>
[...]
<ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Visibility" Storyboard.TargetName="RemoveButton">
<DiscreteObjectKeyFrame KeyTime="00:00:00" Value="Visible"/>
</ObjectAnimationUsingKeyFrames>
[...]
And the code in my Mainpage.xaml.cs file is this:
private void btnRemove_Click(object sender, System.Windows.RoutedEventArgs e)
{
radUpload.CancelUpload(); // Call the actual Cancel function of RadUpload
// Ask the handler to delete the file
}
I need the btnRemove_Click function to call the handler and ask it to use File.Delete in order to delete the file which was just uploaded (I only allow single file uploads).
Which is the best way of creating this? All your help is welcome.
Thank you.
Kind Regards,
Konstantinos