我在第 1 列创建了带有复选框的列表视图,但它仅在标题级别显示,并且在行中我正在获取命名空间名称。
这是 XAML 代码:
<ListView x:Name="ConfigurationFilesGrid" ItemsSource="{Binding ConfigurationFiles}"
SelectedItem="{Binding SelectedProgramFile}"
ScrollViewer.CanContentScroll="True"
PreviewMouseDoubleClick="ConfigurationFilesGrid_Reselect"
>
<ListView.View>
<GridView>
<GridViewColumn>
<GridViewColumn.HeaderTemplate>
<DataTemplate>
<CheckBox HorizontalAlignment="Center" VerticalAlignment="Center" IsChecked="{Binding ElementName=ConfigurationMainCtrl, Path=DataContext.IsAllConfigurationSelected}"/>
</DataTemplate>
</GridViewColumn.HeaderTemplate>
</GridViewColumn>
<GridViewColumn Header="{x:Static res:Resources.IDColNameTxt}" DisplayMemberBinding="{Binding ID}" />
<GridViewColumn Header="{x:Static res:Resources.TypeColHdr}" DisplayMemberBinding="{Binding DisplayType}" />
<GridViewColumn Header="{x:Static res:Resources.NameColNameTxt}" DisplayMemberBinding="{Binding Name}"/>
<GridViewColumn Header="{x:Static res:Resources.MeterColNameTxt}" DisplayMemberBinding="{Binding MeterType}"/>
<GridViewColumn Header="{x:Static res:Resources.RateColNameTxt}" DisplayMemberBinding="{Binding RateDisplay}"/>
<GridViewColumn Header="{x:Static res:Resources.CommentColNameTxt}" DisplayMemberBinding="{Binding Comment}"/>
<GridViewColumn Header="{x:Static res:Resources.ModifiedDateColNameTxt}" DisplayMemberBinding="{Binding ModifiedDateTime}"/>
<GridViewColumn Header="{x:Static res:Resources.ProfileColNameTxt}" DisplayMemberBinding="{Binding Profile}"/>
</GridView>
</ListView.View>
</ListView>
我得到的列表视图如下:
[](checkbox) ID Name Address
name 1 A X
name 2 B Y
但是从上面我只在标题级别而不是行级别得到复选框,所以什么变化将从上面的 xaml 代码反映到复选框。
谢谢你的帮助。
唠叨