Example #1
0
 public DataSourceSorting()
 {
     InitializeComponent();
     viewModel           = new ContatsViewModel();
     sfDataSource        = new Syncfusion.DataSource.DataSource();
     sfDataSource.Source = viewModel.ContactsList;
     sfDataSource.BeginInit();
     sfDataSource.SortDescriptors.Add(new SortDescriptor("ContactName"));
     sfDataSource.EndInit();
     listView.ItemsSource     = sfDataSource.DisplayItems;
     optionList.SelectedIndex = 0;
 }
 public DataSourceGettingStarted()
 {
     InitializeComponent();
     viewModel            = new DataSourceGettingStartedViewModel();
     sfDataSource         = new Syncfusion.DataSource.DataSource();
     viewModel.DataSource = sfDataSource;
     sfDataSource.Source  = viewModel.BookInfo as IEnumerable <BookDetails>;
     sfDataSource.BeginInit();
     viewModel.filtertextchanged = OnFilterChanged;
     sfDataSource.SortDescriptors.Add(new SortDescriptor()
     {
         Direction    = ListSortDirection.Descending,
         PropertyName = "BookID",
     });
     sfDataSource.EndInit();
     listView.ItemsSource      = sfDataSource.DisplayItems;
     ColumnsList.SelectedIndex = 0;
 }
 public DataSourceGrouping()
 {
     InitializeComponent();
     viewModel           = new ContatsViewModel();
     sfDataSource        = new Syncfusion.DataSource.DataSource();
     sfDataSource.Source = viewModel.ContactsList;
     sfDataSource.BeginInit();
     sfDataSource.SortDescriptors.Add(new SortDescriptor("ContactName"));
     sfDataSource.GroupDescriptors.Add(new GroupDescriptor()
     {
         PropertyName = "ContactName",
         KeySelector  = (object obj1) =>
         {
             var item = (obj1 as Contacts);
             return(item.ContactName[0].ToString());
         }
     });
     sfDataSource.EndInit();
     listView.ItemsSource = sfDataSource.DisplayItems;
 }