WPF 控件【L】ListView(一) ListView如何实现单行SelectedItem或多行SelectedItems的绑定

WPF 控件【L】ListView(一) ListView如何实现单行SelectedItem或多行SelectedItems的绑定一、SelectedItemListView的SelectedItem默认只能选择一行,那么我要绑定选中多行呢?怎么办?二、SelectedItems只能用Prism架构的命令方式,这种方式可以绑定多行SelectedItems。xmlns:i=”http://schemas.microsoft.com/expression/2010/interactivity”&lt…

一、SelectedItem

ListView的SelectedItem默认只能选择一行,那么我要绑定选中多行呢?怎么办?

二、SelectedItems

只能用Prism架构的命令方式,这种方式可以绑定多行SelectedItems。

 xmlns:i=”http://schemas.microsoft.com/expression/2010/interactivity”

  <ListView x:Name="lvPatientList" Height="536" Width="1904" Style="{StaticResource ListViewStyle_HistoryPage1}" ItemContainerStyle="{StaticResource ListViewItemContainerStyle}" ItemsSource="{Binding PatientInfoList}" SelectedIndex="{Binding SelectIndex}">
                <i:Interaction.Triggers>
                    <!--加载-->
                    <i:EventTrigger EventName="Loaded">
                        <i:InvokeCommandAction Command="{Binding LoadedCommand}"/>
                    </i:EventTrigger>

                    <!--选中事件-->
                    <i:EventTrigger EventName="SelectionChanged">
                        <prism:InvokeCommandAction Command="{Binding PatientInfoTableSelectedCommand}" CommandParameter="{Binding SelectedItems, ElementName=lvPatientList}" />
                    </i:EventTrigger>

                    <!--鼠标双击事件-->
                    <i:EventTrigger EventName="MouseDoubleClick">
                        <i:InvokeCommandAction Command="{Binding ListViewDoubleClickCommand}"/>
                    </i:EventTrigger>
                </i:Interaction.Triggers>
                
                <ListView.View>
                    <GridView ColumnHeaderContainerStyle="{StaticResource DefaultGridViewColumnHeader57x1527}">
                        <GridViewColumn Header="{DynamicResource History.ListView_Checking.PatientID.Content}" Width="135" DisplayMemberBinding="{Binding Path=PatientId}"/>
                        <GridViewColumn Header="{DynamicResource History.ListView_Checking.CheckingNum.Content}" Width="150" DisplayMemberBinding="{Binding Path=StudyID}"/>
                        <GridViewColumn Header="{DynamicResource History.ListView_Checking.Name.Content}" Width="78" DisplayMemberBinding="{Binding Path=PatientName}"/>
                        <GridViewColumn Header="{DynamicResource History.ListView_Checking.Sex.Content}" Width="78" DisplayMemberBinding="{Binding Path=PatientSex}"/>

                        <GridViewColumn Header="{DynamicResource History.ListView_Checking.Age.Content}" Width="78" DisplayMemberBinding="{Binding Path=PatientAge}"/>
                        <GridViewColumn Header="{DynamicResource History.ListView_Checking.Birth.Content}" Width="104" DisplayMemberBinding="{Binding Path=PatientBirthDate}"/>
                        <GridViewColumn Header="{DynamicResource History.ListView_Checking.Height.Content}" Width="118" DisplayMemberBinding="{Binding Path=PatientHeight}"/>
                        <GridViewColumn Header="{DynamicResource History.ListView_Checking.Weight.Content}" Width="106" DisplayMemberBinding="{Binding Path=PatientWeight}"/>

                        <GridViewColumn Header="{DynamicResource History.ListView_Checking.RecordSource.Content}" Width="112" DisplayMemberBinding="{Binding Path=PatientSource}"/>
                        <GridViewColumn Header="{DynamicResource History.ListView_Checking.CheckingTime.Content}" Width="103" DisplayMemberBinding="{Binding Path=StudyDateTime}"/>
                        <GridViewColumn Header="{DynamicResource History.ListView_Checking.EquipmentType.Content}" Width="103" DisplayMemberBinding="{Binding Path=Modality}"/>
                        <GridViewColumn Header="{DynamicResource History.ListView_Checking.CheckParts.Content}" Width="226" DisplayMemberBinding="{Binding Path=StudyBodyDesc}"/>

                        <GridViewColumn Header="{DynamicResource History.ListView_Checking.SequencesNum.Content}" Width="112" DisplayMemberBinding="{Binding Path=SeriesCount}"/>
                        <GridViewColumn Header="{DynamicResource History.ListView_Checking.CheckStutas.Content}" Width="112" DisplayMemberBinding="{Binding Path=StudyCompleteFlag}"/>
                        <GridViewColumn Header="{DynamicResource History.ListView_Checking.SuspendState.Content}" Width="112" DisplayMemberBinding="{Binding Path=SuspendState}"/>
                        <GridViewColumn Header="{DynamicResource History.ListView_Checking.FilmPrint.Content}" Width="112" DisplayMemberBinding="{Binding Path=PatientPrintFlag}"/>
                    </GridView>
                </ListView.View>
            </ListView>

 

版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 举报,一经查实,本站将立刻删除。
如需转载请保留出处:https://bianchenghao.cn/35479.html

(0)
编程小号编程小号

相关推荐

发表回复

您的电子邮箱地址不会被公开。 必填项已用*标注