0

IHI가보기에 내 윈도우 폰 응용 프로그램에서 내가 가진 :텍스트 블록에서 텍스트의 일부를 클릭 할 때 이벤트를 호출하는 방법은 무엇입니까? 나는 텍스트를 클릭하면 :

<TextBlock x:Name="lblink" FontSize="15" Margin="30,0,24,0" Height="30" Text="*use a [email protected] if you are not the member" TextWrapping="Wrap" HorizontalAlignment="Left" /> 

는이 같은 기능을해야 "[email protected]"그것은 이벤트를 호출해야

이 문제를 어떻게 해결할 수 있습니까?

+0

해당 이벤트를 다른 페이지로 리디렉션 하시겠습니까? –

+0

더는 생각을 다른 TextBlock을이를 통해 – revolutionkpi

+0

이동을 채우지하고 있어야한다 http://stackoverflow.com/questions/6193027/selecting-the-tapped-on-word-on-a-single-click-in -textbox –

답변

2

그래서, 다음 코드를 사용해보십시오 : 이것은 당신에게 클릭 할 수있는 영역을 제공

<StackPanel Orientation="Horizontal"> 
      <TextBlock Text="*use a "/> 
      <TextBlock Text="[email protected]" Tap="TextBlock_Tap"/> 
      <TextBlock Text=" if you are not the member"/> 

     </StackPanel> 
+0

전자 메일 속성을 사용하여 UserControl에 만들 수 있으며 필요한 경우 다른 텍스트가 정적 인 경우 변경할 수 있습니다. –

2

HyperlinkButton을 사용하지 않는 이유는 무엇입니까? 이렇게하면 Content 속성에 텍스트를 설정 한 다음 Click 이벤트 처리기를 구현할 수 있습니다.

또는, 당신은 버튼 컨트롤의 템플릿을 사용할 수 있습니다로 구현됩니다

<phone:PhoneApplicationPage.Resources> 

    <ControlTemplate x:Key="MyButtonTemplate" TargetType="Button"> 
     <TextBlock x:Name="lblink" FontSize="15" Margin="30,0,24,0" Height="30" Text="*use a [email protected] if you are not the member" TextWrapping="Wrap" HorizontalAlignment="Left" /> 
    </ControlTemplate> 

</phone:PhoneApplicationPage.Resources> 

은 다음과 같습니다

<Button x:Key="MyButton" Template="{StaticResource MyButtonTemplate}" Click="MyButton_Click" /> 

그런 다음 당신은 MyButton_Click 이벤트 처리기에 필요한 무엇이든 할 수 있습니다.

+0

질문을 이해 했으므로 저자가 전자 메일 주소만을 클릭하면 화재 이벤트를 원합니다. –

+0

공정한 포인트 로마. HyperlinkButton 또는 Button 메서드는 전자 메일 주소로만 설정된 내용을 가진 가로 스택 패널의 일부로 쉽게 포함될 수 있습니다. –

0
   <TextBlock> 
        <Run Text="*use a " /> 
        <Hyperlink Click="[click event]"> 
         <Run Text="[email protected]" /> 
        </Hyperlink> 
        <Run Text=" if you are not the member" /> 
       </TextBlock> 

나는 당신이 찾고있는 생각합니다.

관련 문제