单击按钮时如何按特定列排序WPF列表视图

时间:2015-09-15 20:51:12

标签: wpf listview sql-order-by

所以,我有一个包含来自数据库的一些数据的Listview,当我按下OrderBy按钮时,我需要按Class列对数据进行排序。任何人都能帮助我吗? 下面是屏幕的打印屏幕。

http://imgur.com/31cNRfT

按钮的xaml是:                                                                - >                           - >                                                                           

                    <GridViewColumn Header="TimeLine"       DisplayMemberBinding="{Binding TimelineID}" />
                    <GridViewColumn Header="Segment No. "   DisplayMemberBinding="{Binding Path = SegmentID}" />
                    <GridViewColumn Header="Session Id"     DisplayMemberBinding="{Binding SessionId}" />
                    <GridViewColumn Header="Gun Start"      DisplayMemberBinding="{Binding IsGunStart}" />
                    <GridViewColumn Header="Record Time"    DisplayMemberBinding="{Binding CountTowardsTotalTime}" />
                    <GridViewColumn Header="Comp No" DisplayMemberBinding="{Binding CompetitionNo}"/>
                    <GridViewColumn Header="Lap No."        DisplayMemberBinding="{Binding Path = LapNo}" />
                    <GridViewColumn Header="Segment Time"   DisplayMemberBinding="{Binding Path = LapTime, Converter = {StaticResource timeSpanConverter}}" />
                    <GridViewColumn Header="Deleted"        DisplayMemberBinding="{Binding Path = Deleted}" />
                    <GridViewColumn Header="Invalid"        DisplayMemberBinding="{Binding Path = Invalid}" />
                    <GridViewColumn Header="Source"         DisplayMemberBinding="{Binding Source}" />
                    <GridViewColumn Header="Hits"           DisplayMemberBinding="{Binding RFID}" />

                </GridView>
            </ListView.View>
        </ListView>

和按钮:

                     余量=&#34; 0,0,5,0&#34;了borderThickness =&#34; 0&#34;                      的Horizo​​ntalAlignment =&#34;右&#34; Horizo​​ntalContentAlignment =&#34;中心&#34;点击=&#34; btnSortStandings_Click&#34;&GT;

                    <ToggleButton.ToolTip>
                        <TextBlock>Order by Class</TextBlock>
                    </ToggleButton.ToolTip>

            </ToggleButton>

0 个答案:

没有答案