Esempio n. 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;
 }
Esempio n. 2
0
        private void OnSortDirectionChanged(object sender, EventArgs e)
        {
            Picker newPicker = (Picker)sender;
            var    direction = newPicker.Items[newPicker.SelectedIndex];

            sfDataSource.BeginInit();

            sfDataSource.SortDescriptors.Clear();
            sfDataSource.SortDescriptors.Add(new SortDescriptor()
            {
                PropertyName = "ContactName",
                Direction    = direction == "Ascending" ? Syncfusion.DataSource.ListSortDirection.Ascending : Syncfusion.DataSource.ListSortDirection.Descending
            });
            sfDataSource.EndInit();
        }
 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;
 }