这是我的代码:
<Canvas Width="100" Height="120">
<Image Name="First_Image" Source="{'Tag of Second_Image'}" Canvas.ZIndex="2" Width="80" Height="80" Canvas.Top="0" Canvas.Left="10"/>
<Image Name="Second_Image" Uid="{Binding XPath=@Name}" Canvas.ZIndex="2" Width="80" Height="20" Canvas.Bottom="20" Canvas.Left="10"
MouseLeftButtonDown="TTX" Tag="/Images/Image.png" Style="{StaticResource Function}"/>
</Canvas>
我正在尝试将我的第一个图像源设置为等于Tag of Second_Image。怎么可能?
答案 0 :(得分:3)
使用ElementName绑定:
<Image Source="{Binding Tag, ElementName=Second_Image}" .../>
<Image x:Name="Second_Image" Tag="/Images/Image.png" .../>