public DataSourceGettingStarted() { tableView = new UITableView(); tableView.RowHeight = 100; tableView.SeparatorColor = UIColor.Clear; tableView.EstimatedRowHeight = 100; viewModel = new DataSourceGettingStartedViewModel(); viewModel.SetRowstoGenerate(100); sfDataSource = new DataSource(); sfDataSource.Source = viewModel.BookInfo; sfDataSource.DisplayItems.CollectionChanged += DisplayItems_CollectionChanged; sfDataSource.LiveDataUpdateMode = Syncfusion.DataSource.LiveDataUpdateMode.AllowDataShaping; sfDataSource.SortDescriptors.Add(new SortDescriptor() { Direction = Syncfusion.DataSource.ListSortDirection.Descending, PropertyName = "BookID", }); tableView.Source = new TableViewSource(sfDataSource); searchbar = new UISearchBar(); searchbar.OnEditingStarted += HandleOnEditingStarted; searchbar.TextChanged += HandleTextChanged; searchbar.CancelButtonClicked += HandleCancelButtonClicked; searchbar.EnablesReturnKeyAutomatically = false; searchbar.Placeholder = "Search in All Columns"; viewModel.filtertextchanged = OnFilterChanged; option = new DataSourceOptionsView(viewModel, searchbar, this); this.OptionView = option; this.AddSubview(searchbar); this.AddSubview(this.tableView); }
public override Android.Views.View GetSampleContent(Android.Content.Context context) { LinearLayout linear = new LinearLayout(context); linear.Orientation = Orientation.Vertical; dataSource = new DataSource(); viewModel = new DataSourceGettingStartedViewModel(context); viewModel.SetRowstoGenerate(100); listView = new ListView(context); dataSource.Source = viewModel.BookInfo; dataSource.LiveDataUpdateMode = Syncfusion.DataSource.LiveDataUpdateMode.AllowDataShaping; dataSource.SortDescriptors.Add(new SortDescriptor() { Direction = Syncfusion.DataSource.ListSortDirection.Descending, PropertyName = "BookID", }); listView.Adapter = new CustomAdapter(dataSource, context); filterText = new SearchView(context); filterText.SetIconifiedByDefault(false); filterText.SetPadding(0, 0, 0, (int)(10 * context.Resources.DisplayMetrics.Density)); this.filterText.KeyPress += FilterText_KeyPress; filterText.SetQueryHint("Enter the text to filter"); filterText.QueryTextChange += OnFilterTextChanged; viewModel.Filtertextchanged = OnFilterChanged; linear.AddView(new LinearLayout(context) { Focusable = true, FocusableInTouchMode = true }, 0, 0); linear.AddView(filterText); linear.AddView(listView); return(linear); }