<Rectangle x:Name="Color01" Fill="#FFF4F4F5" HorizontalAlignment="Left" Height="100" Margin="10,29,0,0" Stroke="Black" VerticalAlignment="Top" Width="100">
<i:Interaction.Triggers>
<i:EventTrigger EventName="MouseDown">
<i:InvokeCommandAction Command="{Binding MyCommand}" CommandParameter="{Binding ???}"/>
</i:EventTrigger>
</i:Interaction.Triggers>
</Rectangle>
我应该在装订中写什么?
答案 0 :(得分:2)
您可以使用 RelativeSource
标记扩展程序传递名称:
CommandParameter="{Binding Name, RelativeSource={RelativeSource
Mode=FindAncestor, AncestorType=Rectangle}}"