Example #1
0
 protected override void OnDetachingFrom(SampleView bindable)
 {
     datagrid  = null;
     datapager = null;
     viewModel = null;
     base.OnDetachingFrom(bindable);
 }
Example #2
0
        /// <summary>
        /// You can override this method to subscribe to AssociatedObject events and initialize properties.
        /// </summary>
        /// <param name="bindAble">SampleView type of bindAble</param>
        protected override void OnAttachedTo(SampleView bindAble)
        {
            this.viewModel                   = new DataPagerViewModel();
            bindAble.BindingContext          = this.viewModel;
            this.datagrid                    = bindAble.FindByName <Syncfusion.SfDataGrid.XForms.SfDataGrid>("dataGrid");
            this.datapager                   = bindAble.FindByName <SfDataPager>("dataPager");
            this.datapager.PageSize          = 20;
            this.datapager.Source            = this.viewModel.OrdersInfo;
            this.datagrid.ItemsSource        = this.datapager.PagedSource;
            this.datapager.AppearanceManager = new PagerAppearance();
            if (Device.RuntimePlatform == Device.UWP || Device.Idiom == TargetIdiom.Tablet || Device.RuntimePlatform == Device.macOS)
            {
                this.datapager.NumericButtonCount = 14;
            }
            else if (Device.Idiom == TargetIdiom.Phone)
            {
                this.datapager.NumericButtonCount = 6;
            }

            if (Device.RuntimePlatform == Device.UWP)
            {
                this.datapager.HeightRequest = 50;
            }

            base.OnAttachedTo(bindAble);
        }
Example #3
0
 /// <summary>
 /// You can override this method while View was detached from window
 /// </summary>
 /// <param name="bindAble">A sampleView type of bindAble</param>
 protected override void OnDetachingFrom(SampleView bindAble)
 {
     this.datagrid  = null;
     this.datapager = null;
     this.viewModel = null;
     base.OnDetachingFrom(bindAble);
 }
Example #4
0
        /// <summary>
        /// Initializes the required properties of the data pager.
        /// </summary>
        /// <param name="bindAble">The sample view that hosts the data grid and the data pager.</param>
        private void InitPager(SampleView bindAble)
        {
            this.datagrid        = bindAble.FindByName <Syncfusion.SfDataGrid.XForms.SfDataGrid>("dataGrid");
            this.datapager       = bindAble.FindByName <SfDataPager>("dataPager");
            this.selectionPicker = bindAble.FindByName <PickerExt>("SelectionPicker");
            if (this.selectionPicker != null)
            {
                this.selectionPicker.Items.Add("Rectangle");
                this.selectionPicker.Items.Add("Circle");
                this.selectionPicker.SelectedIndexChanged += this.SelectionPicker_SelectedIndexChanged;
                this.datapager.AppearanceManager           = new PagerAppearance();
            }
            else
            {
                this.datapager.PropertyChanged += this.DatapagerPropertyChanged;
            }

            this.datapager.PageSize   = 20;
            this.datapager.Source     = this.viewModel.OrdersInfo;
            this.datagrid.ItemsSource = this.datapager.PagedSource;
            (this.datapager.Children[1] as ScrollView).Scrolled += this.PagingBehavior_Scrolled;
            if (Device.RuntimePlatform == Device.UWP || Device.Idiom == TargetIdiom.Tablet || Device.RuntimePlatform == Device.macOS)
            {
                this.datapager.NumericButtonCount = 12;
            }
            else if (Device.Idiom == TargetIdiom.Phone || Device.RuntimePlatform == Device.WPF)
            {
                this.datapager.NumericButtonCount = 6;
            }

            if (Device.RuntimePlatform == Device.UWP)
            {
                this.datapager.HeightRequest = 50;
            }
        }
Example #5
0
        /// <summary>
        /// You can override this method to subscribe to AssociatedObject events and initialize properties.
        /// </summary>
        /// <param name="bindAble">SampleView type of bindAble</param>
        protected override void OnAttachedTo(SampleView bindAble)
        {
            this.viewModel          = new DataPagerViewModel();
            bindAble.BindingContext = this.viewModel;
            this.datagrid           = bindAble.FindByName <Syncfusion.SfDataGrid.XForms.SfDataGrid>("dataGrid");
            this.datapager          = bindAble.FindByName <SfDataPager>("dataPager");
            this.selectionPicker    = bindAble.FindByName <PickerExt>("SelectionPicker");
            this.selectionPicker.Items.Add("Rectangle");
            this.selectionPicker.Items.Add("Circle");
            this.selectionPicker.SelectedIndexChanged += this.SelectionPicker_SelectedIndexChanged;
            this.datapager.PageSize          = 20;
            this.datapager.Source            = this.viewModel.OrdersInfo;
            this.datagrid.ItemsSource        = this.datapager.PagedSource;
            this.datapager.AppearanceManager = new PagerAppearance();
            (this.datapager.Children[1] as ScrollView).Scrolled += this.PagingBehavior_Scrolled;
            if (Device.RuntimePlatform == Device.UWP || Device.Idiom == TargetIdiom.Tablet || Device.RuntimePlatform == Device.macOS)
            {
                this.datapager.NumericButtonCount = 12;
            }
            else if (Device.Idiom == TargetIdiom.Phone || Device.RuntimePlatform == Device.WPF)
            {
                this.datapager.NumericButtonCount = 6;
            }

            if (Device.RuntimePlatform == Device.UWP)
            {
                this.datapager.HeightRequest = 50;
            }

            base.OnAttachedTo(bindAble);
        }
Example #6
0
 protected override void OnDetachingFrom(SampleView bindable)
 {
     listView        = null;
     PagingViewModel = null;
     dataPager       = null;
     base.OnDetachingFrom(bindable);
 }
Example #7
0
 /// <summary>
 /// You can override this method while View was detached from window
 /// </summary>
 /// <param name="bindAble">A sampleView type of bindAble</param>
 protected override void OnDetachingFrom(SampleView bindAble)
 {
     this.selectionPicker.SelectedIndexChanged -= this.SelectionPicker_SelectedIndexChanged;
     this.datagrid  = null;
     this.datapager = null;
     this.viewModel = null;
     base.OnDetachingFrom(bindAble);
 }
        /// <summary>Called when sorting columns.</summary>
        /// <param name="sfDataPager">The sf data pager.</param>
        public void OnSortColumnsExecute(SfDataPager sfDataPager)
        {
            sfDataPager.PagedSource.ResetCache();
            sfDataPager.PagedSource.ResetCacheForPage(SfDataPager.PageIndex);

            _sortDescriptions = sfDataPager.PagedSource.SortDescriptions;

            sfDataPager.MoveToPage(SfDataPager.PageIndex);
        }
Example #9
0
 /// <summary>
 /// You can override this method while View was detached from window
 /// </summary>
 /// <param name="bindAble">A sampleView type of bindAble</param>
 protected override void OnDetachingFrom(SampleView bindAble)
 {
     this.selectionPicker.SelectedIndexChanged           -= this.SelectionPicker_SelectedIndexChanged;
     (this.datapager.Children[1] as ScrollView).Scrolled -= this.PagingBehavior_Scrolled;
     this.datagrid  = null;
     this.datapager = null;
     this.viewModel = null;
     base.OnDetachingFrom(bindAble);
 }
 protected override void OnAttachedTo(ContentPage bindable)
 {
     listView                   = bindable.FindByName <Syncfusion.ListView.XForms.SfListView>("listView");
     dataPager                  = bindable.FindByName <SfDataPager>("dataPager");
     PagingViewModel            = new PagingViewModel();
     listView.BindingContext    = PagingViewModel;
     dataPager.PageCount        = 5;
     dataPager.OnDemandLoading += DataPager_OnDemandLoading;
     base.OnAttachedTo(bindable);
 }
Example #11
0
 protected override void OnAttachedTo(SampleView bindable)
 {
     listView                   = bindable.FindByName <Syncfusion.ListView.XForms.SfListView>("listView");
     dataPager                  = bindable.FindByName <SfDataPager>("dataPager");
     PagingViewModel            = new PagingViewModel();
     listView.BindingContext    = PagingViewModel;
     dataPager.Source           = PagingViewModel.pagingProducts;
     dataPager.OnDemandLoading += DataPager_OnDemandLoading;
     base.OnAttachedTo(bindable);
 }
        /// <summary>Called when loading is required.</summary>
        /// <param name="sfDataPager">The sf data pager.</param>
        /// <param name="args">
        ///   The
        ///   <see cref="Syncfusion.UI.Xaml.Controls.DataPager.OnDemandLoadingEventArgs" /> instance
        ///   containing the event data.
        /// </param>
        public async void OnDemandLoadExecuteAsync(
            SfDataPager sfDataPager, OnDemandLoadingEventArgs args)
        {
            // Fix for SfDataPager calling on close...
            if (IsClosed)
            {
                return;
            }

            var items = await DataPager.LoadPageAsync(args.StartIndex, PageSize).ConfigureAwait(true);

            sfDataPager.LoadDynamicItems(args.StartIndex, items);
            sfDataPager.PagedSource.Refresh();
        }
Example #13
0
 protected override void Dispose(bool disposing)
 {
     if (disposing)
     {
         if (SfDataPager != null)
         {
             SfDataPager = null;
         }
         if (SfGrid != null)
         {
             SfGrid.AutoGeneratingColumn -= GridAutoGenerateColumns;
             SfGrid.Dispose();
             SfGrid = null;
         }
     }
     base.Dispose(disposing);
 }
Example #14
0
        public Paging()
        {
            this.SfDataPager                    = new SfDataPager();
            this.SfDataPager.PageSize           = 15;
            this.SfDataPager.Source             = new PagingViewModel().OrdersInfo;
            this.SfDataPager.NumericButtonCount = 20;
            this.AddSubview(this.SfDataPager);

            this.SfGrid = new SfDataGrid();
            this.SfGrid.AutoGeneratingColumn         += GridAutoGenerateColumns;
            this.SfGrid.SelectionMode                 = SelectionMode.Single;
            this.SfGrid.ItemsSource                   = SfDataPager.PagedSource;
            this.SfGrid.ShowRowHeader                 = false;
            this.SfGrid.HeaderRowHeight               = 45;
            this.SfGrid.RowHeight                     = 45;
            this.SfGrid.GridStyle.AlternatingRowColor = UIColor.FromRGB(219, 219, 219);
            this.AddSubview(this.SfGrid);
        }
Example #15
0
        public override Android.Views.View GetSampleContent(Android.Content.Context context)
        {
            sfDataPager                    = new SfDataPager(context);
            sfGrid                         = new SfDataGrid(context);
            sfGrid.SelectionMode           = SelectionMode.Single;
            viewModel                      = new PagingViewModel();
            sfDataPager.PageSize           = 15;
            sfDataPager.Source             = viewModel.OrdersInfo;
            sfDataPager.NumericButtonCount = 20;
            sfGrid.AutoGeneratingColumn   += GridGenerateColumns;
            sfGrid.ItemsSource             = sfDataPager.PagedSource;
            sfGrid.VerticalOverScrollMode  = VerticalOverScrollMode.None;

            LinearLayout linearLayout = new LinearLayout(context);

            linearLayout.Orientation = Orientation.Vertical;
            linearLayout.AddView(sfDataPager, new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MatchParent, (int)SfDataGridHelpers.ConvertDpToPixels(this.sfGrid, 75)));
            linearLayout.AddView(sfGrid);

            return(linearLayout);
        }
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            Button      exportPdf;
            Button      exportExcel;
            SfDataPager sfDataPager;

            intentKey = Intent.GetStringExtra(GetString(Resource.String.InformesIntentKey));
            LinearLayout linearLayout = new LinearLayout(this);

            linearLayout.Orientation = Orientation.Vertical;

            exportPdf      = new Button(this);
            exportPdf.Text = "Exportar PDF";
            exportPdf.SetMaxHeight(200);
            exportPdf.SetMaxWidth(100);
            exportPdf.Click += ExportToPdf;
            exportExcel      = new Button(this);
            exportExcel.Text = "Exportar Excel";
            exportExcel.SetMaxHeight(200);
            exportExcel.SetMaxWidth(100);
            exportExcel.Click += ExportToExcel;

            sfDataPager                    = new SfDataPager(this);
            sfGrid                         = new SfDataGrid(this);
            sfDataPager.PageSize           = 10;
            sfDataPager.NumericButtonCount = 20;

            switch (intentKey)
            {
            case "Informe Coordenadas":
                sfDataPager.Source = Perfil_Login.ListaCoordenadasEmpleado;
                break;

            default:
                sfDataPager.Source = Perfil_Login.ListaEmpleadosAsignados;
                break;
            }

            sfGrid.ItemsSource        = sfDataPager.PagedSource;
            sfGrid.SelectionMode      = SelectionMode.Single;
            sfGrid.AllowSorting       = true;
            sfGrid.SelectionChanging += sfGrid_SelectionChanging;

            LinearLayout option = new LinearLayout(this);

            option.SetGravity(GravityFlags.Center);
            option.Orientation = Orientation.Horizontal;
            option.AddView(exportPdf, Convert.ToInt32(150 * sfGrid.Resources.DisplayMetrics.Density), ViewGroup.LayoutParams.WrapContent);
            option.AddView(exportExcel, Convert.ToInt32(150 * sfGrid.Resources.DisplayMetrics.Density), ViewGroup.LayoutParams.WrapContent);
            LinearLayout.LayoutParams layoutparams = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.WrapContent, ViewGroup.LayoutParams.WrapContent);
            layoutparams.SetMargins(0, (int)(20 * sfGrid.Resources.DisplayMetrics.Density), 0, (int)(20 * sfGrid.Resources.DisplayMetrics.Density));
            layoutparams.Gravity    = GravityFlags.CenterHorizontal;
            option.LayoutParameters = layoutparams;

            linearLayout.AddView(sfDataPager, new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MatchParent, (int)SfDataGridHelpers.ConvertDpToPixels(sfGrid, 75)));
            linearLayout.AddView(option);
            linearLayout.AddView(sfGrid);
            SetContentView(linearLayout);
        }
 public PageNavigationController(SfDataPager pager)
 {
     dataPager = pager;
 }
        /// <inheritdoc />
        protected override Task CloseAsync()
        {
            SfDataPager = null;

            return(base.CloseAsync());
        }
Example #19
0
 public ItemGenerator(SfDataPager pager)
 {
     Items     = new List <ScrollableElement>();
     dataPager = pager;
 }