2017-07-07 2 views
0

私は自分のアプリケーションでこのコードを持っている:Xamarinバインディング参照はすべての要素に必要ですか?

<StackLayout x:Name="pfs" HorizontalOptions="FillAndExpand" VerticalOptions="FillAndExpand"> 

    <StackLayout Grid.Row="0" Grid.Column="1" Padding="0,0,20,0" Orientation="Horizontal" 
     HorizontalOptions="EndAndExpand" VerticalOptions="CenterAndExpand"> 
     <Label x:Name="scoreCountLabel" 
     TextColor="{Binding BindingContext.TickMarkColor, Source={Reference pfs}}"/> 
    </StackLayout> 

私はTEXTCOLORが設定されているかを理解しようとしています。誰かが私に説明する理由を教えてください。Source = {Reference pfs}

pfsという名前のStackLayoutに既に入っているので、なぜこれが必要なのですか?

答えて

2

私が知る限り、完全に不要です。 BindingContextはすべてのサブビューに継承されるため、親ビューのBindingContextの参照は冗長です。

TextColor="{Binding TickMarkColor}"/> 

完了。

関連する問題