title: How to get selected image name in message box?
body: <p>I am retrieving images from database from particular table. It's showing all images from that table.</p>
  
  <p>Now I need to get that selected image name, it's displaying the name using binding and ToolTip, but I need to get when I click the image, selected image  name should be view in message box.</p>
  
  <p>This is my code: </p>
  
  <p>imageView.cs-page.</p>
  
  <pre><code>var query1 = DB_Linq.tbl_ItemMaster.Select(cust =&gt; new { cust.Item_Code, cust.Item_Image,cust.ImagePath, cust.ItemName_EN }).ToList();
  
  
                  var QBM1 = (from po in DB_Linq.tbl_ItemMaster
                               where po.ActiveFlag == true
                               select new ImageEntity
                              {
                                  ImagePath = po.ImagePath,
                                  ItemName_EN = po.ItemName_EN       
  
                              }
                             );
  
                  return QBM1.ToList&lt;ImageEntity&gt;();
  </code></pre>
  
  <p>ImageEntity.cs</p>
  
  <pre><code>class ImageEntity
      {
          public String ImagePath
          {
              get;
              set;
          }
          public String ItemName_EN
          {
              get;
              set;
          }
  
      }
  </code></pre>
  
  <p>Invoice.Xaml.cs-page</p>
  
  <pre><code>private void BindImages()
          {
              try
              {
                  // Store Data in List Object
                  List&lt;ImageEntity&gt; ListImageObj = ImageView.GetAllImagesData();
  
                  // Check List Object Count
                  if (ListImageObj.Count &gt; 0)
                  {
                      // Bind Data in List Box Control.
                      LsImageGallery.DataContext = ListImageObj;
  
  
                  }
              }
              catch (Exception ex)
              {
                  throw new Exception(ex.Message);
              }
          }
  </code></pre>
  
  <p>Xaml code is:</p>
  
  <pre><code>&lt;Page.Resources&gt;
          &lt;ItemsPanelTemplate x:Key="ListBox_HorizontalItems"&gt;
              &lt;StackPanel Orientation="Horizontal" /&gt;
          &lt;/ItemsPanelTemplate&gt;
  
  
          &lt;DataTemplate x:Key="ImageGalleryDataTemplate" x:Name="ImageGalleryDataTemplate"  &gt;
              &lt;Grid&gt;
                  &lt;Border BorderBrush="ForestGreen" BorderThickness="3"  Width="120" Height="120" Padding="10" Margin="15" CornerRadius="10"&gt;
  
                      &lt;Image Source="{Binding ImagePath}" Stretch="Fill"  HorizontalAlignment="Center" &gt;
  
                          &lt;Image.ToolTip&gt;
                              &lt;Grid&gt;
                                  &lt;Image Source="{Binding ImagePath}" Stretch="Fill" HorizontalAlignment="Center" Height="100" Width="100"&gt;&lt;/Image&gt;
  
                              &lt;/Grid&gt;
                          &lt;/Image.ToolTip&gt;                    
  
                      &lt;/Image&gt;                 
  
                  &lt;/Border&gt;
                  &lt;Border&gt;
                      &lt;Grid&gt;
                          &lt;TextBlock Text="{Binding ItemName_EN}" ToolTip="{Binding ItemName_EN}" /&gt;               
                      &lt;/Grid&gt;                   
                  &lt;/Border&gt;
                  &lt;Grid x:Name="LayoutRoot" Background="DarkGreen" &gt;
                      &lt;Button   Click="ButtonClicked" ToolTip="{Binding ItemName_EN}" &gt;
                          &lt;Image Source="{Binding ImagePath}" Stretch="Fill" Height="100" Width="100" HorizontalAlignment="Center"/&gt;
                      &lt;/Button&gt;
                  &lt;/Grid&gt;
  
              &lt;/Grid&gt;
          &lt;/DataTemplate&gt;
  
          &lt;ItemsPanelTemplate x:Key="ImageGalleryItemsPanelTemplate"&gt;
  
              &lt;!--Display Images on UniformGrid Panel--&gt;
              &lt;UniformGrid Columns="4" HorizontalAlignment="Center" VerticalAlignment="Stretch"/&gt;
  
          &lt;/ItemsPanelTemplate&gt;
  
      &lt;/Page.Resources&gt;
  
  
  
   &lt;Grid&gt;
          &lt;ListBox x:Name="LsImageGallery"   ItemsSource="{Binding}"  ItemTemplate="{DynamicResource ImageGalleryDataTemplate}" ItemsPanel="{DynamicResource ImageGalleryItemsPanelTemplate}"&gt;
              &lt;ListBox.Background&gt;
                  &lt;LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0"&gt;
                      &lt;GradientStop Color="Black"/&gt;
                      &lt;GradientStop Color="#FF1E2A2F" Offset="1"/&gt;
                  &lt;/LinearGradientBrush&gt;
              &lt;/ListBox.Background&gt;
  
          &lt;/ListBox&gt;
  
  
  &lt;/Grid&gt;
  &lt;/Page&gt;
  </code></pre>