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

Change RadUploadItem Style

1 Answer 119 Views
Upload
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Kz
Top achievements
Rank 1
Kz asked on 11 Feb 2012, 05:40 AM
Hi,

I changed RadUploadITem Style : i,e   the Item will have Combox:: TextBlock :: X ( Ofcourse progress) bar.

1) Now I want to set  itemsource for ComboBox: So that  each item will combobox and its items. How can I set combobox Item source in C# code behind.

2)  User drag and drops some files or he will select files useing "browse Button"  and he will select some value from combobox.

    ->>  How Can I access these selected values for  a particular file ( for each item)  
   
         Lets say  Combobx has   two items  "  validLoan " and " InvalidLoan".

 So  the upload control will have 

               Combox(Valid)   FileName:  johnFile_.text:  X   -------------> ITem1
               Combox(InValid)   FileName:  joeFile_.jpeg:  X   -------------> ITem2
              Combox(Valid)   FileName:  SteveFile_.jpeg:  X   -------------> ITem2 
            Combox(InValid)   FileName:  joeFile_.jpeg:  X   -------------> ITem2 
---------------------------------------------------------------------------------------------------------
So my question is how can we set itemsource for combobox and how can we get the selected valu for a file.?

Here is my RadUploadItem Code

(

<Style x:Key="Priya_RadUploadItemStyle1" TargetType="telerik:RadUploadItem">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate x:Name="Id1" TargetType="telerik:RadUploadItem">
<Grid x:Name="IdGrid" Background="Bisque" ShowGridLines="True" Margin="0,5">
<Grid.ColumnDefinitions>
                                <ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<VisualStateManager.VisualStateGroups>
<VisualStateGroup x:Name="CommonStates">
<VisualState x:Name="Normal"/>
<VisualState x:Name="MouseOver">
<Storyboard>
<DoubleAnimation Duration="0" To=".35" Storyboard.TargetProperty="Opacity" Storyboard.TargetName="MouseOverBackground"/>
</Storyboard>
</VisualState>
<VisualState x:Name="Disabled">
<Storyboard>
<DoubleAnimation Duration="0" To=".55" Storyboard.TargetProperty="Opacity" Storyboard.TargetName="FileProgressBar"/>
</Storyboard>
</VisualState>
</VisualStateGroup>
<VisualStateGroup x:Name="SelectionStates">
<VisualState x:Name="Unselected"/>
<VisualState x:Name="Selected">
<Storyboard>
<DoubleAnimation Duration="0" To=".65" Storyboard.TargetProperty="Opacity" Storyboard.TargetName="SelectedBackground"/>
</Storyboard>
</VisualState>
</VisualStateGroup>
</VisualStateManager.VisualStateGroups>
<Grid Grid.ColumnSpan="3" Visibility="{TemplateBinding SelectionVisibility}">
<Rectangle x:Name="MouseOverBackground" Fill="{StaticResource ControlOuterBorder_Highlighted}" IsHitTestVisible="False" Opacity="0" RadiusY="1" RadiusX="1"/>
<Rectangle x:Name="SelectedBackground" Fill="{StaticResource ControlOuterBorder_Highlighted}" IsHitTestVisible="False" Opacity="0" RadiusY="1" RadiusX="1"/>
</Grid>
<telerik:RadProgressBar x:Name="FileProgressBar" Background="Transparent" Grid.ColumnSpan="3" Height="25" Maximum="{TemplateBinding MaximumProgressValue}" Minimum="0" MinHeight="20" Value="{TemplateBinding ProgressValue}"/>
                            <ComboBox x:Name="cmbBox" Grid.Column="0" Width="90" ></ComboBox>
<TextBlock Grid.Column="1" HorizontalAlignment="Left" Margin="10 0 0 0" TextWrapping="NoWrap" Text="{TemplateBinding FileName}" VerticalAlignment="Center"/>
<StackPanel Grid.Column="2" HorizontalAlignment="Right" Orientation="Horizontal" VerticalAlignment="Center">
<TextBlock Margin="8,0,10,0" TextWrapping="NoWrap" Text="{TemplateBinding FileSize}" VerticalAlignment="Center"/>
<telerik:RadButton Command="{TemplateBinding UpdateCommand}" ToolTipService.ToolTip="{TemplateBinding ErrorMessage}" Visibility="{TemplateBinding ErrorIconVisibility}">
<telerik:RadButton.Template>
<ControlTemplate TargetType="telerik:RadButton">
<Grid Height="17.97" Margin="0,0,10,0" VerticalAlignment="Center" Width="14.609">
<Path Data="M577.89149,269.68195 L584.80031,257.78582 591.50111,269.64775 z" Margin="0,1.786,0,3.288" Stretch="Fill" Stroke="#FFFFFFFF">
<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 FontWeight="Bold" FontSize="8" Height="Auto" Margin="6,4,6,4" TextWrapping="Wrap" Text="!" Width="Auto"/>
</Grid>
</ControlTemplate>
</telerik:RadButton.Template>
</telerik:RadButton>
<telerik:RadButton Command="{TemplateBinding DeleteCommand}" Margin="0,0,7,0" Visibility="{TemplateBinding DeleteButtonVisibility}">
<telerik:RadButton.Template>
<ControlTemplate TargetType="telerik:RadButton">
<Grid Background="Transparent" Cursor="Hand">
<Path x:Name="IconDelete" 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" Fill="#FF000000" Height="12" RenderTransformOrigin="0.5,0.5" Stretch="Fill" VerticalAlignment="Center" Width="12">
<Path.RenderTransform>
<TransformGroup>
<RotateTransform Angle="45"/>
</TransformGroup>
</Path.RenderTransform>
</Path>
</Grid>
</ControlTemplate>
</telerik:RadButton.Template>
</telerik:RadButton>
</StackPanel>
</Grid>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>

)


   

 

1 Answer, 1 is accepted

Sort by
0
Accepted
Alex Fidanov
Telerik team
answered on 15 Feb 2012, 03:49 PM
Hi,

A quick way to do this is to bind the SelectedItem of the ComboBox inside the template to the Tag property of its templated parent - the RadUploadItem, as there is nothing else exposed and the RadUpload is explicitly using RadUploadItems.

All the best,
Alex Fidanov
the Telerik team
Sharpen your .NET Ninja skills! Attend Q1 webinar week and get a chance to win a license! Book your seat now >>
Tags
Upload
Asked by
Kz
Top achievements
Rank 1
Answers by
Alex Fidanov
Telerik team
Share this question
or