This question is locked. New answers and comments are not allowed.
Hi,
I have a Telerik Grid with data templates containing various controls. The layout of the grid is defined as below
Now my question is How to identify the tag property of the control that I click on. I have 3 controls that will be interacted with (Combo Box, Image Control)
When I click on the control <Image Source="Assets/Mail.png" Stretch="Uniform" Width="40" Height="40"Tapped="IMG_Tapped" Tag="{Binding QID}"/> and <Image Source="Assets/Camera-01.png" Stretch="Uniform" Width="40"Height="40" Tapped="Image_Tapped" Tag="{Binding QID}"/> I want to identify the Tag value so that I can do some processing (to change the colour of this Image to RED) after completing the operation.
And finally I want to be able to enumerate through all the combo boxes that do not have the SelectedIndex = -1 (means a value was selected) and save them to a List<>.
Please advice what is the best way to achieve this functionality. I saw this link (http://stackoverflow.com/questions/23645331/how-to-accessing-elements-in-xaml-datatemplate-listview-without-interacting-with) that explains but this code does not work for a Telerik RADGrid.
Thanks,
Rajesh.
I have a Telerik Grid with data templates containing various controls. The layout of the grid is defined as below
<
telerikGrid:RadDataGrid
x:Name
=
"QuestionAnswersGrid"
AutoGenerateColumns
=
"False"
AlternateRowBackground
=
"Lavender"
ScrollViewer.HorizontalScrollMode
=
"Auto"
ScrollViewer.VerticalScrollMode
=
"Auto"
GroupHeaderDisplayMode
=
"Frozen"
Margin
=
"51,44,45,36"
Grid.Row
=
"1"
Width
=
"1200"
UserGroupMode
=
"Disabled"
ItemsSource
=
"{Binding QuestionList}"
>
<
telerikGrid:RadDataGrid.GroupDescriptors
>
<
telerikGrid:PropertyGroupDescriptor
PropertyName
=
"Room"
/>
</
telerikGrid:RadDataGrid.GroupDescriptors
>
<
telerikGrid:RadDataGrid.Columns
>
<
telerikGrid:DataGridTemplateColumn
Header
=
"Question"
SizeMode
=
"Fixed"
Width
=
"700"
>
<
telerikGrid:DataGridTemplateColumn.CellContentTemplate
>
<
DataTemplate
>
<
TextBlock
Text
=
"{Binding Question}"
TextWrapping
=
"Wrap"
/>
</
DataTemplate
>
</
telerikGrid:DataGridTemplateColumn.CellContentTemplate
>
</
telerikGrid:DataGridTemplateColumn
>
<
telerikGrid:DataGridTemplateColumn
Header
=
"Answer"
SizeMode
=
"Fixed"
Width
=
"200"
>
<
telerikGrid:DataGridTemplateColumn.CellContentTemplate
>
<
DataTemplate
>
<
ComboBox
ItemsSource
=
"{Binding Answers}"
DisplayMemberPath
=
"AD_Ans"
SelectedItem
=
"{Binding SelectedAnswer, Mode=TwoWay}"
/>
</
DataTemplate
>
</
telerikGrid:DataGridTemplateColumn.CellContentTemplate
>
</
telerikGrid:DataGridTemplateColumn
>
<
telerikGrid:DataGridTemplateColumn
Header
=
"Notes"
SizeMode
=
"Fixed"
Width
=
"150"
>
<
telerikGrid:DataGridTemplateColumn.CellContentTemplate
>
<
DataTemplate
>
<
StackPanel
>
<
Image
Source
=
"Assets/Mail.png"
Stretch
=
"Uniform"
Width
=
"40"
Height
=
"40"
Tapped
=
"IMG_Tapped"
Tag
=
"{Binding QID}"
/>
</
StackPanel
>
</
DataTemplate
>
</
telerikGrid:DataGridTemplateColumn.CellContentTemplate
>
</
telerikGrid:DataGridTemplateColumn
>
<
telerikGrid:DataGridTemplateColumn
Header
=
"Photo"
SizeMode
=
"Fixed"
Width
=
"150"
>
<
telerikGrid:DataGridTemplateColumn.CellContentTemplate
>
<
DataTemplate
>
<
StackPanel
>
<
Image
Source
=
"Assets/Camera-01.png"
Stretch
=
"Uniform"
Width
=
"40"
Height
=
"40"
Tapped
=
"Image_Tapped"
Tag
=
"{Binding QID}"
/>
</
StackPanel
>
</
DataTemplate
>
</
telerikGrid:DataGridTemplateColumn.CellContentTemplate
>
</
telerikGrid:DataGridTemplateColumn
>
</
telerikGrid:RadDataGrid.Columns
>
</
telerikGrid:RadDataGrid
>
Now my question is How to identify the tag property of the control that I click on. I have 3 controls that will be interacted with (Combo Box, Image Control)
When I click on the control <Image Source="Assets/Mail.png" Stretch="Uniform" Width="40" Height="40"Tapped="IMG_Tapped" Tag="{Binding QID}"/> and <Image Source="Assets/Camera-01.png" Stretch="Uniform" Width="40"Height="40" Tapped="Image_Tapped" Tag="{Binding QID}"/> I want to identify the Tag value so that I can do some processing (to change the colour of this Image to RED) after completing the operation.
And finally I want to be able to enumerate through all the combo boxes that do not have the SelectedIndex = -1 (means a value was selected) and save them to a List<>.
Please advice what is the best way to achieve this functionality. I saw this link (http://stackoverflow.com/questions/23645331/how-to-accessing-elements-in-xaml-datatemplate-listview-without-interacting-with) that explains but this code does not work for a Telerik RADGrid.
Thanks,
Rajesh.