Using a Sortable Grid View in a custom control RRS feed

  • Question

  • I'd like to display related users in a custom control.

    That runs, but I would like to sort them, too. I need:

    a) Sort by Name by default

    b) Sort by clicking the column header.

    This should be possible, by default, i think. But I did not find somthing useful. Would really like a starting point or an code example which works.

    This is the (WPF) XML I'm using for the grid - it is a sortable grid - but does not sort:

    <ListView Name="Lesen" Width="Auto" HorizontalAlignment="Stretch" Height="150" 
                                     ItemsSource="{Binding Path=Lesen, UpdateSourceTrigger=PropertyChanged}" 
                                        <scsm:SortableGridViewColumn Header="Name" DisplayMemberBinding="{Binding DisplayName}" Width="Auto"/>
                                        <scsm:SortableGridViewColumn Header="Mobil" DisplayMemberBinding="{Binding Mobile}" Width="Auto"  />
                                        <scsm:SortableGridViewColumn Header="Telefon" DisplayMemberBinding="{Binding BusinessPhone}" Width="Auto" />

    Wednesday, January 9, 2019 8:43 AM


  • Put this to the resource section:


    and here is the control definition:

      <controls:SortableListView Grid.Row="2" Grid.Column="0" Name="Lesen"  MouseDoubleClick="RBV_MouseDoubleClick" Width="Auto" HorizontalAlignment="Stretch" Height="150"                                  ItemsSource="{Binding Path=Lesen, UpdateSourceTrigger=PropertyChanged}">                            <ListView.View>                                <GridView>                                    <controls:SortableGridViewColumn Header="Name" SortPropertyName="DisplayName" DisplayMemberBinding="{Binding DisplayName}" Width="Auto"/>                                    <controls:SortableGridViewColumn Header="Mobil"  SortPropertyName="Mobile" DisplayMemberBinding="{Binding Mobile}" Width="Auto"/>                                    <controls:SortableGridViewColumn Header="Telefon" SortPropertyName="BusinessPhone" DisplayMemberBinding="{Binding BusinessPhone}" Width="Auto"/>                                </GridView>                            </ListView.View>                        </controls:SortableListView>

    Be aware, if you have a german system, you could get an error

    Severity    Code    Description    Project    File    Line    Suppression State
    Error        The satellite assembly named "Microsoft.EnterpriseManagement.UI.Controls.resources.dll, PublicKeyToken=31bf3856ad364e35" for fallback culture "en" either could not be found or could not be loaded. This is generally a setup problem. Please consider reinstalling or repairing the application.    xxx.Form    xxx.Form.Control.xaml    60    

    but, the code will compile and run in the scsm console.

    Monday, February 11, 2019 7:56 AM