I am trying to access the <Image> control from <DataTemplate> within <GridView> in gridView.SelectionChanged event or gridView.ItemClick event...So please let me know that how I can access this <image> control with all its properties, mainly Source property....
So Please go through the piece of code pasted below:
<Page.Resources>
<DataTemplate x:Key="imageTemplate">
<Border Background="#FF939598">
<StackPanel>
<Border BorderThickness="2" BorderBrush="WhiteSmoke">
<Image Name="img" Source="{Binding}" Height="170" Width="210" Stretch="UniformToFill">
</Image>
</Border>
</StackPanel>
</Border>
</DataTemplate>
</Page.Resources>
<GridView x:Name="gridView" ItemTemplate="{StaticResource imageTemplate}" IsItemClickEnabled="True" ItemClick="gridView_ItemClick" SelectionChanged="gridView_SelectionChanged">
<GridView.ItemsPanel>
<ItemsPanelTemplate>
<WrapGrid MaximumRowsOrColumns="3" AutomationProperties.LiveSetting="Polite"/>
</ItemsPanelTemplate>
</GridView.ItemsPanel>
</GridView>
______________________________________________________________________________________
private void gridView_ItemClick(object sender, ItemClickEventArgs e){
Image clickedItem = (Image)gridView.FindName("img");
string imgSource = clickedItem.Source.ToString();
}
I tried something like this, but no luck..
So please help me with this as I am new to WPF and Windows Apps too... :)
Thanking you all in advance....