Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
486
Sorting removes row selection
posted

Hi,

 

I'm having some trouble with the XamGrid sorting functionality. I use the grid to allow the user to make a selection of multiple items in the XamGrid by using RowSelection. This works fine until the user wants to sort the items, which will cause the selection to disappear. Filtering on the other hand behaves as I need it, leaving the selection intact even if the selected item isn't shown after filtering.

Below I have posted a simple sample showing this behavior. Is there any workaround for this issue? Is this going to be fixed in the next version?

 

Thanks!

 

 

XAML :

 

<UserControl x:Class="XamGridTest.MainPage"

    xmlns=" http://schemas.microsoft.com/winfx/2006/xaml/presentation "

    xmlns:x=" http://schemas.microsoft.com/winfx/2006/xaml "

 

xmlns:ig="clr-namespace:Infragistics.Controls.Grids;assembly=InfragisticsSL4.Controls.Grids.XamGrid.v10.2">

 

    <Grid x:Name="LayoutRoot" Background="White">

      <ig:XamGrid

         x:Name="PersonGrid" SelectedRowsCollectionChanged="PersonGrid_SelectedRowsCollectionChanged"

         AutoGenerateColumns="False"

         Margin="18" Height="200">

         <ig:XamGrid.RowSelectorSettings>

            <ig:RowSelectorSettings x:Name="rowSelectorSettings" Visibility="Visible" EnableRowNumbering="True" />

         </ig:XamGrid.RowSelectorSettings>

         <ig:XamGrid.SelectionSettings>

            <ig:SelectionSettings ColumnSelection="None" CellSelection="None"

                  RowSelection="Multiple"  CellClickAction="SelectRow" />

         </ig:XamGrid.SelectionSettings>

         <ig:XamGrid.FilteringSettings>

            <ig:FilteringSettings AllowFiltering="FilterRowTop" />

         </ig:XamGrid.FilteringSettings>

         <ig:XamGrid.Columns>

            <ig:TextColumn Key="Name" HeaderText="Name" Width="*" />

            <ig:TextColumn Key="Surname" HeaderText="Surname" Width="Auto" />

           

         </ig:XamGrid.Columns>

      </ig:XamGrid>

   </Grid>

</UserControl>

 

Code:

 

using System.Collections.Generic;

using System.Windows.Controls;

 

namespace XamGridTest

{

 

 

   public class Person

   {

      public string Name { get; set; }

      public string Surname { get; set; }

 

      public Person()

      {

        

      }

 

      public Person(string name, string surname)

      {

         Name = name;

         Surname = surname;

      }

   }

 

 

   public partial class MainPage : UserControl

   {

      public MainPage()

      {

         InitializeComponent();

 

         List<Person> persons = new List<Person>();

         persons.Add(new Person("Hans", "Rosenthal"));

         persons.Add(new Person("Robert", "Mayer"));

         persons.Add(new Person("Daniel", "Mayer"));

         persons.Add(new Person("Christian", "Mayer"));

         persons.Add(new Person("Hans", "Bauer"));

         persons.Add(new Person("Kai", "Rosenthal"));

         persons.Add(new Person("Helmut", "Bauer"));

         persons.Add(new Person("Jürgen", "Huber"));

         persons.Add(new Person("Thomas", "Rosenthal"));

         persons.Add(new Person("Julia", "Bauer"));

         persons.Add(new Person("Kerstin", "Huber"));

 

         PersonGrid.ItemsSource = persons;

      }

 

      private void PersonGrid_SelectedRowsCollectionChanged(object sender,

Infragistics.Controls.Grids.SelectionCollectionChangedEventArgs<Infragistics.Controls.Grids.SelectedRowsCollection> e)

      {

         int debug = PersonGrid.SelectionSettings.SelectedRows.Count;

      }

 

   }

}