0
<DataTemplate x:Key="OpenDocument">
            <TextBlock>
        <Hyperlink Name="hypFileLocation" Foreground="{StaticResource XceedHyperLinkForeground}"  Cursor="Hand"  Tag="{Binding RelativeSource={RelativeSource AncestorType={x:Type xcdg:DataRow}}, Path=DataContext[OpenLocation]}" Click="Hyperlink_Click">
          <TextBlock Name="tblkDocumentName" Tag="{Binding RelativeSource={RelativeSource AncestorType={x:Type xcdg:DataRow}}, Path=DataContext[DocumentName]}"   Text="View" ToolTip="{Binding RelativeSource={RelativeSource AncestorType={x:Type xcdg:DataRow}}, Path=DataContext[DocumentName]}"/>
        </Hyperlink>
      </TextBlock>
</DataTemplate>

In xaml, I set tag for both hyperlink & Textblock inside hyperlink. I want to retreive the textblock tag value in C#?

Soner Gönül
  • 97,193
  • 102
  • 206
  • 364
user2285613
  • 199
  • 1
  • 8
  • 17

1 Answers1

0

You can do something like this....Within the click or tap event handler:

I'm not sure about the TextBlock value but you could easily get the HyperLink value.

in .cs, within the event handler: This is a sample

 HyperLink asd = (HyperLink)sender;

 WebBrowserTask webBrowserTask = new WebBrowserTask();            
 webBrowserTask.Uri = new Uri(asd.Tag.ToString());//here you could get the value
 webBrowserTask.Show();

Like wise try it for the Textblock and see.

For more you could refer these:

Getting selected value of listbox windows phone 7

Hope it helps!

Community
  • 1
  • 1
Kulasangar
  • 9,046
  • 5
  • 51
  • 82