Hi,
I have a telerik radWindow for upload images.
My xaml:
First Problem: the delete icon doesn´t work.
Second Problem:
I want to make validations for each item before upload starting.
So in my .cs i have:
I have a RadComboBox for each item that i selected. For each item i must to choose a type.
So, in method RadUpload1_UploadStarted, if the radcombobox is empty or something else....i want to cancel the uploading files without clear the elements.The problem is that "this.RadUpload.CancelUpload" clear all the items.
Thanks
I have a telerik radWindow for upload images.
My xaml:
<
telerik:RadWindow
x:Class
=
"Project.UploadCatalogPagesImages"
xmlns:controls
=
"clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls"
xmlns:telerik
=
"http://schemas.telerik.com/2008/xaml/presentation"
ResizeMode
=
"NoResize"
WindowState
=
"Normal"
WindowStartupLocation
=
"CenterScreen"
Header
=
""
x:Name
=
"radWindowUploadCatalogPagesImages"
>
<
Grid
x:Name
=
"LayoutRoot"
Margin
=
"0"
>
<
Grid.RowDefinitions
>
<
RowDefinition
Height
=
"Auto"
/>
<
RowDefinition
Height
=
"*"
/>
</
Grid.RowDefinitions
>
<
StackPanel
Orientation
=
"Horizontal"
HorizontalAlignment
=
"Stretch"
VerticalAlignment
=
"Stretch"
Background
=
"LightGray"
>
<
TextBlock
x:Name
=
"txtOptions"
FontSize
=
"11"
Foreground
=
"Black"
FontWeight
=
"Bold"
HorizontalAlignment
=
"Right"
Margin
=
"10"
VerticalAlignment
=
"Center"
/>
<
telerik:RadComboBox
IsEditable
=
"False"
x:Name
=
"ComboBoxOptions"
HorizontalAlignment
=
"Left"
ClearSelectionButtonVisibility
=
"Collapsed"
MinWidth
=
"200"
Margin
=
"10"
ItemsSource
=
"{Binding PublicationTypesOptions}"
SelectedItem
=
"{Binding SelectedOption, Mode=TwoWay}"
VerticalAlignment
=
"Center"
DisplayMemberPath
=
"PubTypeDesc"
SelectionChanged
=
"ComboBoxOptions_SelectionChanged"
/>
</
StackPanel
>
<
telerik:RadUpload
Grid.Row
=
"1"
VerticalAlignment
=
"Stretch"
HorizontalAlignment
=
"Stretch"
x:Name
=
"RadUpload"
Margin
=
"0"
Width
=
"400"
Height
=
"430"
Filter
=
"Image Files (*.gif;*.jpg;*.jpeg;*.png)|*.gif;*.jpg;*.jpeg;*.png|All Files(*.*)|*.*"
FilterIndex
=
"0"
IsMultiselect
=
"True"
IsAutomaticUpload
=
"false"
OverwriteExistingFiles
=
"True"
UploadServiceUrl
=
"/FileUploadHandler.ashx"
IsAppendFilesEnabled
=
"True"
FileUploadStarting
=
"RadUpload1_FileUploadStarting"
FileUploaded
=
"RadUpload1_FileUploaded"
UploadFinished
=
"RadUpload_UploadFinished"
UploadStarted
=
"RadUpload1_UploadStarted"
BufferSize
=
"50000"
MaxFileSize
=
"3000000"
MaxUploadSize
=
"10000000"
>
<
telerik:RadUpload.ItemContainerStyle
>
<
Style
TargetType
=
"telerik:RadUploadItem"
>
<
Setter
Property
=
"Template"
>
<
Setter.Value
>
<
ControlTemplate
TargetType
=
"telerik:RadUploadItem"
>
<
Grid
Margin
=
"0,5"
>
<
Grid.ColumnDefinitions
>
<
ColumnDefinition
Width
=
"Auto"
/>
<
ColumnDefinition
Width
=
"*"
/>
</
Grid.ColumnDefinitions
>
<
telerik:RadComboBox
Grid.Column
=
"0"
IsEditable
=
"False"
x:Name
=
"ComboBoxOptionsPage"
HorizontalAlignment
=
"Left"
ClearSelectionButtonVisibility
=
"Collapsed"
MinWidth
=
"50"
Margin
=
"10"
ItemsSource
=
"{Binding CataloguePages}"
SelectedItem
=
"{Binding SelectedOption, Mode=TwoWay}"
EmptyText
=
"Seleccione"
VerticalAlignment
=
"Center"
DisplayMemberPath
=
"Description"
/>
<
Border
Grid.Column
=
"1"
>
<
Grid
>
<
telerik:RadProgressBar
Height
=
"25"
MinHeight
=
"20"
x:Name
=
"FileProgressBar"
Minimum
=
"0"
Maximum
=
"100"
></
telerik:RadProgressBar
>
<
TextBlock
Text
=
"{TemplateBinding FileName}"
HorizontalAlignment
=
"Left"
VerticalAlignment
=
"Center"
Margin
=
"10,0,0,0"
TextWrapping
=
"NoWrap"
/>
<
StackPanel
Orientation
=
"Horizontal"
HorizontalAlignment
=
"Right"
VerticalAlignment
=
"Center"
>
<
TextBlock
Text
=
"{TemplateBinding FileSize}"
Margin
=
"0,0,10,0"
TextWrapping
=
"NoWrap"
VerticalAlignment
=
"Center"
/>
<
Grid
VerticalAlignment
=
"Center"
ShowGridLines
=
"True"
Height
=
"25"
>
<
Path
VerticalAlignment
=
"Center"
x:Name
=
"IconDelete"
Margin
=
"0,-4,10,0"
Cursor
=
"Hand"
Stretch
=
"Fill"
Fill
=
"#FF000000"
Data
=
"M5.0000001,0 L7,0 7,5 12,5 12,7 7,7 7,12 5.0000001,12 5.0000001,7 0,7 0,5 5.0000001,5 5.0000001,0 z"
Width
=
"12"
Height
=
"12"
>
<
Path.RenderTransform
>
<
TransformGroup
>
<
RotateTransform
Angle
=
"45"
/>
</
TransformGroup
>
</
Path.RenderTransform
>
</
Path
>
<
Path
VerticalAlignment
=
"Center"
x:Name
=
"IconDone"
Margin
=
"0,0,10,0"
Stretch
=
"Fill"
Visibility
=
"Collapsed"
Fill
=
"#FF000000"
Data
=
"M719.90131,266.74252 L728,276.64667 L743.13574,254.96999 L727.96881,271.52853"
Width
=
"12"
Height
=
"12"
/>
<
Grid
VerticalAlignment
=
"Center"
x:Name
=
"IconError"
Margin
=
"0,0,10,0"
Visibility
=
"Collapsed"
Width
=
"14.6"
Height
=
"18"
>
<
Path
Stretch
=
"Fill"
Stroke
=
"#FFFFFFFF"
Margin
=
"0,1.786,0,3.288"
Data
=
"M577.89149,269.68195 L584.80031,257.78582 591.50111,269.64775 z"
>
<
Path.Fill
>
<
LinearGradientBrush
EndPoint
=
"0.5,0"
StartPoint
=
"0.5,1"
>
<
GradientStop
Color
=
"#FFFFC600"
Offset
=
"0"
/>
<
GradientStop
Color
=
"#FFFDFF00"
Offset
=
"1"
/>
</
LinearGradientBrush
>
</
Path.Fill
>
</
Path
>
<
TextBlock
Margin
=
"6,4,6,4"
Width
=
"Auto"
Height
=
"Auto"
FontSize
=
"8"
FontWeight
=
"Bold"
Text
=
"!"
TextWrapping
=
"Wrap"
/>
</
Grid
>
</
Grid
>
</
StackPanel
>
</
Grid
>
</
Border
>
</
Grid
>
</
ControlTemplate
>
</
Setter.Value
>
</
Setter
>
</
Style
>
</
telerik:RadUpload.ItemContainerStyle
>
</
telerik:RadUpload
>
</
Grid
>
</
telerik:RadWindow
>
First Problem: the delete icon doesn´t work.
Second Problem:
I want to make validations for each item before upload starting.
So in my .cs i have:
private void RadUpload1_UploadStarted(object sender, Telerik.Windows.Controls.UploadStartedEventArgs e)
{
cataloguePagesForValidation = new Dictionary<
string
, string>();
cataloguePagesForImages = new Dictionary<
string
, string>();
try
{
foreach (RadUploadItem item in RadUpload.Items)
{
RadComboBox descriptionTextBox = item.FindChildByType<
RadComboBox
>();
cataloguePagesForValidation.Add(((Pages)(descriptionTextBox.SelectedValue)).Id, item.FileName);
cataloguePagesForImages.Add(item.FileName, ((Pages)(descriptionTextBox.SelectedValue)).Id);
}
}
catch
{
this.RadUpload.CancelUpload();
}
}
I have a RadComboBox for each item that i selected. For each item i must to choose a type.
So, in method RadUpload1_UploadStarted, if the radcombobox is empty or something else....i want to cancel the uploading files without clear the elements.The problem is that "this.RadUpload.CancelUpload" clear all the items.
Thanks