How to access a control placed inside data template of listbox?
- by Subhen
Hi I have the following code:
<ListBox x:Name="foldersListBox" Grid.Column="0" MouseLeftButtonUp="foldersListBox_MouseLeftButtonUp"
BorderThickness="0" Height="AUTO"
ScrollViewer.HorizontalScrollBarVisibility="Disabled"
ScrollViewer.VerticalScrollBarVisibility="Disabled">
<DataTemplate>
<Border BorderBrush="LightGray"
BorderThickness="2"
CornerRadius="4">
<Image x:Name="folderImage" Width="70" Height="70" Margin="3" />
</Border>
</DataTemplate>
</ListBox>
Now when I am trying to access folderImage from code behind. I can use the loaded event and typecast the sender as Image type , but I dont want that way.
Help plz.
Thanks,
Subhen