2017-02-15 7 views
0

私は次のマークアップを持っているのタップイベント:Nativescript FormattedString - スパン

<StackLayout paddingLeft="15" paddingRight="15" dock="top" > 
 
    <Label textWrap="true"> 
 
    <Label.formattedText> 
 
     <FormattedString> 
 
     <FormattedString.spans> 
 
      <Span text="By checking 'yes' I understand that this is a legally valid and binding written agreement, and I indicate that I have read, understand, and agree to the terms of my " /> 
 
      <Span text="Agreement. " foregroundColor="#3aba90" tap="viewAgreemnent" /> 
 
      <Span text="Also, by checking 'yes', I certify that I have read and agree to accept electronically the " /> 
 
      <Span text="Privacy Policy." foregroundColor="#3aba90" tap="viewPolicy" /> 
 
     </FormattedString.spans> 
 
     </FormattedString> 
 
    </Label.formattedText> 
 
    </Label> 
 
</StackLayout>

これは別の色でレンダリング契約およびプライバシーポリシーに1つのテキストブロックを作成します。目標は、ユーザーが契約書またはポリシーを表示する機能を実行するためにタップするときです。問題は、スパンに対してタップイベントが発生しないことです。このイベントは、このレベルでもトップレベルのラベルレベルでのみ利用できますか?

これを達成するためのアイデアはありますか?

ありがとうございました。

答えて

0

あなたは

<Span text="Privacy Policy." foregroundColor="#3aba90" tap="{{ $parents['Page'].viewPolicy }}" /> https://docs.nativescript.org/core-concepts/data-binding#binding-to-a-parent-binding-context

+0

おかげでロブをしたいです。これはうまくいかないようです。 $ parents ['Page']はページのbindingContextを指しているようで、実際のメソッドはそのコンテキストでは利用できません。何か不足していますか? – dpdragnev

+0

私はTelerikから、SpanはViewから派生したものではなく、イベントをサポートしていないことを確認しました。 – dpdragnev