将弹出控件放置在ListView的单元格上
本文关键字:ListView 单元格 控件 | 更新日期: 2023-09-27 18:09:36
我有一个列表视图,并希望在按下按钮时显示弹出窗口上的更多信息。无论如何,我的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)当第二列上的按钮被点击。
<ToggleButton x:Name="theButton">
...
</ToggleButton>
<Popup IsOpen="{Binding IsChecked, ElementName=theButton">
...
</Popup>