2016-12-01 9 views
0

テキストのように別の要素をホバーすると、Pathの色の色を変更したいと思います。同じ階層の他の要素からFontColorをバインドする

両方の要素が同じ階層の高さにあります。それらはWrapPanelの中に置かれます。

<WrapPanel> 
    <Path Data="{StaticResource Email}" Fill="{Binding ??}"/> 
    <TextBlock>Einstellungen</TextBlock> 
</WrapPanel> 

どのように私はTextBlockForegroundプロパティにPathFillプロパティをバインドすることができますか? x:Nameを使用せずに可能ですか?

+0

「名前」を使用しない理由は何ですか? – Markinson

+0

@Derp私は約20種類のボタンがあるので。 – MyNewName

答えて

0
<WrapPanel> 
     <Rectangle Width="20" Height="20" Fill="{Binding Tag,RelativeSource={RelativeSource Mode=FindAncestor,   
AncestorType={x:Type WrapPanel}}}"/> 
     <TextBlock Foreground="{Binding RelativeSource={RelativeSource Mode=FindAncestor,   
AncestorType={x:Type WrapPanel}}, Path=Tag,Mode=OneWayToSource}">Sample</TextBlock> 
    </WrapPanel> 
関連する問題