我有一个列表视图,并希望在按下按钮时在弹出窗口中显示更多信息。无论如何我的listview看起来像:
<ListView Name="TableListView">
<ListView.View>
<GridView>
<GridViewColumn Width="50"
Header="ID">
<GridViewColumn.CellTemplate>
<DataTemplate>
<Label Content="{Binding Id}"
HorizontalAlignment="Center" />
</DataTemplate>
</GridViewColumn.CellTemplate>
</GridViewColumn>
<!-- I am having trouble with this column! -->
<GridViewColumn Width="50"
Header="ID">
<GridViewColumn.CellTemplate>
<DataTemplate>
<StackPanel>
<Button Content="Click to show more Info">
<Button.Triggers>
<Trigger Property="IsMouseOver"
Value="True">
<Setter TargetName="PopupSelectFile"
Property="IsOpen"
Value="True">
</Setter>
</Trigger>
</Button.Triggers>
</Button>
<Popup x:Name="PopupSelectFile">
<Button Width="100"
Height="100"></Button>
</Popup>
</StackPanel>
</DataTemplate>
</GridViewColumn.CellTemplate>
</GridViewColumn>
</GridView>
</ListView.View>
</ListView>
基本上我想在单击第二列上的按钮时显示一个弹出窗口(PopupSelectFile)。
答案 0 :(得分:2)
<ToggleButton x:Name="theButton">
...
</ToggleButton>
<Popup IsOpen="{Binding IsChecked, ElementName=theButton">
...
</Popup>