我在窗口中包含一个列表(见下文)。窗口DataContext具有两个属性,Items和AllowItemCommand。
如何获得对绑定Hyperlink的Command属性需要解析对窗口的DataContext?
<ListView ItemsSource="{Binding Items}">
<ListView.View>
<GridView>
<GridViewColumn Header="Action">
<GridViewColumn.CellTemplate>
<DataTemplate>
<StackPanel>
<TextBlock>
<!-- this binding is not working -->
<Hyperlink Command="{Binding AllowItemCommand}"
CommandParameter="{Binding .}">
<TextBlock Text="Allow" />
</Hyperlink>
</TextBlock>
</StackPanel>
</DataTemplate>
</GridViewColumn.CellTemplate>
</GridViewColumn>
</GridView>
</ListView.View>
</ListView>
您能否进入调试器并逐步构建UI?如果是这样,您可以进入变量并尝试深入
—
了解吗?