Esempio n. 1
0
 protected override void OnDetachingFrom(ContentPage bindable)
 {
     picker.SelectedIndexChanged -= Picker_SelectedIndexChanged;
     pullToRefresh = null;
     picker        = null;
     base.OnDetachingFrom(bindable);
 }
 public override void Destroy()
 {
     pullToRefresh.Refreshing -= Pull_Refreshing;
     viewModel = null;
     pullToRefresh.Dispose();
     pullToRefresh = null;
 }
Esempio n. 3
0
        /// <summary>
        /// You can override this method while View was detached from window
        /// </summary>
        /// <param name="bindAble">Sample View typed parameter named as bindAble</param>
        protected override void OnAttachedTo(SampleView bindAble)
        {
            this.viewModel          = new PullToRefreshViewModel();
            bindAble.BindingContext = this.viewModel;
            this.pullToRefresh      = bindAble.FindByName <SfPullToRefresh>("pullToRefresh");
            this.subGrid1           = bindAble.FindByName <Grid>("SubGrid1");
            this.subGrid2           = bindAble.FindByName <Grid>("SubGrid2");
            this.listView           = bindAble.FindByName <SfListView>("listView");
            this.transitionType     = bindAble.FindByName <PickerExt>("transitionType");
            this.label2             = bindAble.FindByName <Label>("label2");
            this.label3             = bindAble.FindByName <Label>("label3");
            this.imagedata          = bindAble.FindByName <Image>("imagedata");

            this.subGrid1.BindingContext        = this.viewModel.Data;
            this.pullToRefresh.PullingThreshold = 100;
            this.listView.ItemsSource           = this.viewModel.SelectedData;
            if (Device.RuntimePlatform == Device.iOS)
            {
                this.pullToRefresh.SizeChanged += this.Pull_SizeChanged;
            }

            this.pullToRefresh.Refreshing   += this.PullToRefresh_Refreshing;
            this.pullToRefresh.Refreshed    += this.PullToRefresh_Refreshed;
            this.listView.SelectionChanging += this.ListView_SelectionChanging;
            this.transitionType.Items.Add("Push");
            this.transitionType.Items.Add("SlideOnTop");
            this.transitionType.SelectedIndex         = 1;
            this.transitionType.SelectedIndexChanged += this.OnSelectionChanged;
            base.OnAttachedTo(bindAble);
        }
 /// <summary>
 /// You can override this method while View was detached from window
 /// </summary>
 /// <param name="bindAble">SampleView type parameter named as bindAble</param>
 protected override void OnDetachingFrom(SampleView bindAble)
 {
     this.transitionType.SelectedIndexChanged -= this.OnSelectionChanged;
     this.pullToRefresh.Refreshing            -= this.PullToRefresh_Refreshing;
     this.pullToRefresh  = null;
     this.dataGrid       = null;
     this.transitionType = null;
     base.OnDetachingFrom(bindAble);
 }
Esempio n. 5
0
 protected override void OnAttachedTo(ContentPage bindable)
 {
     pullToRefresh = bindable.FindByName <SfPullToRefresh>("pullToRefresh");
     picker        = bindable.FindByName <Picker>("transitionTypePicker");
     picker.Items.Add("SlideOnTop");
     picker.Items.Add("Push");
     picker.SelectedIndex         = 1;
     picker.SelectedIndexChanged += Picker_SelectedIndexChanged;
     base.OnAttachedTo(bindable);
 }
        protected override void OnAttachedTo(ContentPage bindable)
        {
            PullToRefresh             = bindable.FindByName <SfPullToRefresh>("pullToRefresh");
            ListView                  = bindable.FindByName <SfListView>("listView");
            BC                        = new MainPageViewModel(ListView);
            ListView.BindingContext   = BC;
            PullToRefresh.Refreshing += PullToRefresh_Refreshing;

            base.OnAttachedTo(bindable);
        }
 public override View GetSampleContent(Context context)
 {
     pullToRefresh = new SfPullToRefresh(context);
     pullToRefresh.TransitionType = TransitionType.Push;
     pullToRefresh.Refreshing    += Pull_Refreshing;
     listView         = new ListView(context);
     repository       = new InboxRepositiory();
     adapter          = new CustomBaseAdapter((Activity)context, repository.InboxItems);
     listView.Adapter = adapter;
     pullToRefresh.PullableContent = listView;
     return(pullToRefresh);
 }
Esempio n. 8
0
 public PullToRefreshDemo()
 {
     load();
     mainView      = new PullableContentView(baseView, scrollView, label);
     pullToRefresh = new SfPullToRefresh();
     pullToRefresh.RefreshContentThreshold = 0;
     mainView.BackgroundColor = UIColor.FromRGBA(0.012f, 0.608f, 0.898f, 1);
     AddSubview(pullToRefresh);
     pullToRefresh.Refreshing     += PullToRefresh_Refreshing;
     pullToRefresh.PullableContent = mainView;
     this.OptionView = new Options(pullToRefresh);
 }
Esempio n. 9
0
 protected override void Dispose(bool disposing)
 {
     if (disposing)
     {
         if (pullToRefresh != null)
         {
             pullToRefresh.Refreshing -= PullToRefresh_Refreshing;
             pullToRefresh.Dispose();
             pullToRefresh = null;
         }
     }
     base.Dispose(disposing);
 }
 /// <summary>
 /// You can override this method to subscribe to AssociatedObject events and initialize properties.
 /// </summary>
 /// <param name="bindAble">SampleView type parameter named as bindAble</param>
 protected override void OnAttachedTo(SampleView bindAble)
 {
     this.viewModel            = new DataGridPullToRefreshViewModel();
     bindAble.BindingContext   = this.viewModel;
     this.pullToRefresh        = bindAble.FindByName <SfPullToRefresh>("pullToRefresh");
     this.dataGrid             = bindAble.FindByName <SfDataGrid>("dataGrid");
     this.transitionType       = bindAble.FindByName <PickerExt>("transitionType");
     this.dataGrid.ItemsSource = this.viewModel.OrdersInfo;
     this.transitionType.Items.Add("SlideOnTop");
     this.transitionType.Items.Add("Push");
     this.transitionType.SelectedIndex         = 0;
     this.transitionType.SelectedIndexChanged += this.OnSelectionChanged;
     this.pullToRefresh.Refreshing            += this.PullToRefresh_Refreshing;
     this.pullToRefresh.Pulling += this.PullToRefresh_Pulling;
     base.OnAttachedTo(bindAble);
 }
        public PullToRefreshView()
        {
            InitializeComponent();
            pull                = new SfPullToRefresh();
            DataSource          = GetWeatherData();
            this.Padding        = new Thickness(0, -10, 0, 0);
            pull.TransitionMode = TransitionType.SlideonTop;
            transitionType.Items.Add("Push");
            transitionType.Items.Add("SlideOnTop");
            transitionType.SelectedIndex         = 1;
            transitionType.SelectedIndexChanged += (object sender, EventArgs e) => {
                if (transitionType.SelectedIndex == 0)
                {
                    if (Device.OS != TargetPlatform.Android)
                    {
                        pull.ProgressBackground  = Color.FromRgb(3, 155, 229);
                        pull.ProgressStrokeColor = Color.White;
                    }
                    pull.TransitionMode = TransitionType.Push;
                }
                else
                {
                    if (Device.OS != TargetPlatform.Android)
                    {
                        pull.ProgressBackground  = Color.White;
                        pull.ProgressStrokeColor = Color.FromRgb(3, 155, 229);
                    }
                    pull.TransitionMode = TransitionType.SlideonTop;
                }
            };

            pull.RefreshedEvent += Pull_pullToRefreshedEvent;
            if (Device.OS == TargetPlatform.iOS)
            {
                pull.SizeChanged += Pull_SizeChanged;
            }

            if (Device.OS == TargetPlatform.Windows)
            {
                this.ContentView             = pull;
                transitionType.SelectedIndex = 0;
                pull.SizeChanged            += Pull_SizeChanged;
                pull.TransitionMode          = TransitionType.Push;
                pull.ProgressRadius          = 9;
            }
        }
Esempio n. 12
0
        /// <summary>
        /// You can override this method to subscribe to AssociatedObject events and initialize properties.
        /// </summary>
        /// <param name="bindAble">SampleView type parameter named as bindAble</param>
        protected override void OnAttachedTo(SampleView bindAble)
        {
            this.viewModel   = new DataGridPullToRefreshViewModel();
            this.progressbar = new SfCircularProgressBar();
            this.border      = new SfBorder();

            this.border.BorderColor     = Color.LightGray;
            this.border.BackgroundColor = Color.White;
            this.border.CornerRadius    = 35;
            this.border.Content         = this.progressbar;
            this.border.BorderWidth     = 0.2;

            this.progressbar.SegmentCount                   = 10;
            this.progressbar.IndicatorInnerRadius           = 0.5;
            this.progressbar.IndicatorOuterRadius           = 0.7;
            this.progressbar.ShowProgressValue              = true;
            this.progressbar.GapWidth                       = 0.5;
            this.progressbar.WidthRequest                   = 70;
            this.progressbar.HeightRequest                  = 55;
            this.progressbar.IndeterminateAnimationDuration = 750;

            bindAble.BindingContext   = this.viewModel;
            this.pullToRefresh        = bindAble.FindByName <SfPullToRefresh>("pullToRefresh");
            this.dataGrid             = bindAble.FindByName <SfDataGrid>("dataGrid");
            this.transitionType       = bindAble.FindByName <PickerExt>("transitionType");
            this.dataGrid.ItemsSource = this.viewModel.OrdersInfo;
            this.transitionType.Items.Add("SlideOnTop");
            this.transitionType.Items.Add("Push");
            this.transitionType.SelectedIndex         = 0;
            this.transitionType.SelectedIndexChanged += this.OnSelectionChanged;
            this.pullToRefresh.Refreshing            += this.PullToRefresh_Refreshing;
            this.pullToRefresh.Pulling += this.PullToRefresh_Pulling;

            var pullingTemplate = new DataTemplate(() =>
            {
                return(new ViewCell {
                    View = this.border
                });
            });

            this.pullToRefresh.PullingViewTemplate    = pullingTemplate;
            this.pullToRefresh.RefreshingViewTemplate = pullingTemplate;

            base.OnAttachedTo(bindAble);
        }
Esempio n. 13
0
        /// <summary>
        /// You can override this method to subscribe to AssociatedObject events and initialize properties.
        /// </summary>
        /// <param name="bindAble">SampleView type of parameter named as bindAble</param>
        protected override void OnAttachedTo(SampleView bindAble)
        {
            this.listView = bindAble.FindByName <SfListView>("listView");
            this.pulltoRefreshViewModel            = new ListViewPullToRefreshViewModel();
            this.pulltoRefreshViewModel.Navigation = bindAble.Navigation;
            this.listView.BindingContext           = this.pulltoRefreshViewModel;
            this.listView.ItemsSource = this.pulltoRefreshViewModel.BlogsInfo;

            this.pullToRefresh             = bindAble.FindByName <SfPullToRefresh>("pullToRefresh");
            this.pullToRefresh.Refreshing += this.PullToRefresh_Refreshing;

            this.picker = bindAble.FindByName <PickerExt>("transitionTypePicker");
            this.picker.Items.Add("SlideOnTop");
            this.picker.Items.Add("Push");
            this.picker.SelectedIndex         = 1;
            this.picker.SelectedIndexChanged += this.Picker_SelectedIndexChanged;
            base.OnAttachedTo(bindAble);
        }
        protected override void OnAttachedTo(ContentPage bindable)
        {
            ListView = bindable.FindByName <SfListView>("listView");
            pulltoRefreshViewModel            = new ListViewPullToRefreshViewModel();
            pulltoRefreshViewModel.Navigation = bindable.Navigation;
            ListView.BindingContext           = pulltoRefreshViewModel;
            ListView.ItemsSource = pulltoRefreshViewModel.BlogsInfo;

            pullToRefresh             = bindable.FindByName <SfPullToRefresh>("pullToRefresh");
            pullToRefresh.Refreshing += PullToRefresh_Refreshing;

            picker = bindable.FindByName <Picker>("transitionTypePicker");
            picker.Items.Add("SlideOnTop");
            picker.Items.Add("Push");
            picker.SelectedIndex         = 1;
            picker.SelectedIndexChanged += Picker_SelectedIndexChanged;
            base.OnAttachedTo(bindable);
        }
Esempio n. 15
0
 /// <summary>
 /// You can override this method while View was detached from window
 /// </summary>
 /// <param name="bindAble">SampleView typed parameter named as bindAble</param>
 protected override void OnDetachingFrom(SampleView bindAble)
 {
     this.pullToRefresh.SizeChanged           -= this.Pull_SizeChanged;
     this.pullToRefresh.Refreshing            -= this.PullToRefresh_Refreshing;
     this.pullToRefresh.Refreshed             -= this.PullToRefresh_Refreshed;
     this.listView.SelectionChanging          -= this.ListView_SelectionChanging;
     this.transitionType.SelectedIndexChanged -= this.OnSelectionChanged;
     this.pullToRefresh  = null;
     this.viewModel      = null;
     this.listView       = null;
     this.subGrid1       = null;
     this.subGrid2       = null;
     this.transitionType = null;
     this.label2         = null;
     this.label3         = null;
     this.imagedata      = null;
     base.OnDetachingFrom(bindAble);
 }
 public SfDataGridInPullToRefresh()
 {
     this.pullToRefresh = new SfPullToRefresh();
     this.pullToRefresh.RefreshContentThreshold = 45;
     this.SfGrid = new SfDataGrid();
     this.SfGrid.SelectionMode         = SelectionMode.Single;
     this.SfGrid.AutoGeneratingColumn += GridAutoGenerateColumns;
     viewModel = new GridGettingStartedViewModel();
     this.SfGrid.ItemsSource     = viewModel.OrdersInfo;
     this.SfGrid.ShowRowHeader   = false;
     this.SfGrid.HeaderRowHeight = 45;
     this.SfGrid.RowHeight       = 45;
     this.SfGrid.GridStyle.AlternatingRowColor = UIColor.FromRGB(219, 219, 219);
     this.SfGrid.AllowResizingColumn           = true;
     this.SfGrid.GridStyle = new CustomGridStyle();
     this.pullToRefresh.PullableContent = SfGrid;
     this.pullToRefresh.Refreshing     += PullToRefresh_Refreshing;
     this.AddSubview(this.pullToRefresh);
     this.OptionView = new Options(pullToRefresh);
 }
Esempio n. 17
0
 public override View GetSampleContent(Context context)
 {
     pullToRefresh             = new SfPullToRefresh(context);
     pullToRefresh.Refreshing += Pull_Refreshing;
     sfGrid = new SfDataGrid(context);
     sfGrid.HeaderRowHeight = 52;
     pullToRefresh.RefreshContentThreshold = 52;
     sfGrid.RowHeight     = 48;
     viewModel            = new PullToRefreshViewModel();
     sfGrid.SelectionMode = SelectionMode.Single;
     viewModel.SetRowstoGenerate(100);
     sfGrid.AutoGenerateColumns = false;
     sfGrid.ColumnSizer         = ColumnSizer.Star;
     GridGenerateColumns();
     sfGrid.ItemsSource            = (viewModel.OrdersInfo);
     sfGrid.AllowResizingColumn    = true;
     sfGrid.VerticalOverScrollMode = VerticalOverScrollMode.None;
     pullToRefresh.PullableContent = sfGrid;
     return(pullToRefresh);
 }
        protected override void OnAttachedTo(ContentPage bindable)
        {
            viewModel                   = new ListViewSwipingViewModel();
            firstLV                     = bindable.FindByName <Syncfusion.ListView.XForms.SfListView>("firstLV");
            secondLV                    = bindable.FindByName <Syncfusion.ListView.XForms.SfListView>("secondLV");
            button                      = bindable.FindByName <Button>("Reset");
            sfPullToRefresh             = bindable.FindByName <SfPullToRefresh>("pullToRefresh");
            sfPullToRefresh.Refreshing += SfPullToRefresh_Refreshing;

            firstLV.BindingContext  = viewModel;
            secondLV.BindingContext = viewModel;
            button.BindingContext   = viewModel;
            firstLV.ItemsSource     = viewModel.FirstLVCollection;
            firstLV.ItemsSource     = viewModel.SecondLVCollection;

            viewModel.firstLV  = firstLV;
            viewModel.secondLV = secondLV;

            base.OnAttachedTo(bindable);
        }
Esempio n. 19
0
        public UICollectionViewInPullToRefresh()
        {
            this.pullToRefresh             = new SfPullToRefresh();
            this.pullToRefresh.Refreshing += PullToRefresh_Refreshing;

            this.collectionViewFlowLayout = new UICollectionViewFlowLayout()
            {
                MinimumLineSpacing = 0.3f,
                ScrollDirection    = UICollectionViewScrollDirection.Vertical,
            };

            this.collectionView = new UICollectionView(CGRect.Empty, collectionViewFlowLayout);
            this.collectionView.ShowsHorizontalScrollIndicator = false;
            this.collectionViewSource      = new CollectionViewSource();
            this.collectionView.DataSource = this.collectionViewSource;
            this.collectionView.RegisterClassForCell(typeof(CollectionViewCell), CollectionViewCell.CellID);
            this.pullToRefresh.PullableContent = this.collectionView;
            this.pullToRefresh.PullableContent.BackgroundColor = UIColor.LightGray;
            this.AddSubview(this.pullToRefresh);
            this.OptionView = new Options(pullToRefresh);
        }
Esempio n. 20
0
        public Options(SfPullToRefresh pullToRefresh)
        {
            transtionMode      = new UILabel();
            transtionMode.Text = "Transition: Push / SlideOnTop";

            transtion               = new UISwitch();
            transtion.On            = pullToRefresh.TransitionType == TransitionType.SlideOnTop ? true : false;
            transtion.ValueChanged += (sender, e) =>
            {
                pullToRefresh.TransitionType = transtion.On ? TransitionType.SlideOnTop : TransitionType.Push;
                if (pullToRefresh.PullableContent.GetType() != typeof(SfDataGrid))
                {
                    pullToRefresh.RefreshContentThreshold = transtion.On ? 0 : 17;
                }
                else
                {
                    pullToRefresh.PullingThreshold = transtion.On ? 90 : 120;
                }
            };
            this.AddSubview(transtionMode);
            this.AddSubview(transtion);
        }
Esempio n. 21
0
        public DashboardPage()
        {
            Title          = "Dashboard";
            BindingContext = VM;

            SfPullToRefresh pull = new SfPullToRefresh {
            };
            ObservableCollection <Team> teams = new ObservableCollection <Team>
            {
                new Team {
                    Name = "Team 1"
                },
                new Team {
                    Name = "Team 2"
                }
            };
            SfListView list = new SfListView
            {
                ItemsSource  = teams,
                ItemTemplate = new DataTemplate(() =>
                {
                    Image icon      = new Image();
                    Label nameLabel = new Label();

                    icon.Source = "ic_team";

                    nameLabel.SetBinding(Label.TextProperty, "Name");
                    nameLabel.FontSize = 18;

                    var template = new ViewCell
                    {
                        View = new StackLayout
                        {
                            Padding     = new Thickness(10, 5),
                            Orientation = StackOrientation.Horizontal,
                            Children    =
                            {
                                icon,
                                new StackLayout
                                {
                                    Padding         = new Thickness(10, 0),
                                    VerticalOptions = LayoutOptions.CenterAndExpand,
                                    Children        =
                                    {
                                        nameLabel
                                    }
                                }
                            }
                        }
                    };
                    return(template);
                })
            };

            pull.PullingEvent += (sender, args) =>
            {
                DisplayAlert("User", Settings.UserId, "OK");

                Device.StartTimer(new TimeSpan(0, 0, 2), () =>
                {
                    return(false);
                });
            };

            pull.RefreshingEvent += sender =>
            {
                DisplayAlert("User", App.User.Id, "OK");

                Device.StartTimer(new TimeSpan(0, 0, 2), () =>
                {
                    return(false);
                });
            };
            pull.PullableContent = new Button();

            pull.TransitionMode = TransitionType.SlideonTop;

            Content = pull;
        }
Esempio n. 22
0
 public override void Destroy()
 {
     handler.RemoveCallbacks(run);
     pull.Dispose();
     pull = null;
 }
Esempio n. 23
0
        public override View GetSampleContent(Context context)
        {
            handler = new Handler();

            LayoutInflater layoutInflater = LayoutInflater.From(context);

            view = layoutInflater.Inflate(Resource.Layout.pulltorefresh, null);

            Calendar         cal        = Calendar.GetInstance(Java.Util.TimeZone.Default);
            SimpleDateFormat dateformat = new SimpleDateFormat("EEEE, MMMM dd ");
            String           strDate    = dateformat.Format(cal.Time);

            linearLayout = (LinearLayout)view;
            linearLayout.SetBackgroundColor(Color.ParseColor("#039be5"));
            linearLayoutChild = (LinearLayout)view.FindViewById(Resource.Id.pullscroller);
            dataSource        = GetData();

            TextView textView3 = (TextView)view.FindViewById(Resource.Id.text);

            String          s   = "" + dataSource[0].Temperature + (char)0x00B0 + "/12";
            SpannableString ss1 = new SpannableString(s);

            ss1.SetSpan(new RelativeSizeSpan(2f), 0, 4, SpanTypes.ExclusiveExclusive);
            textView3.SetText(ss1, TextView.BufferType.Normal);
            ImageView imageView = (ImageView)view.FindViewById(Resource.Id.imageview);

            imageView.SetImageResource(dataSource[0].Type);
            TextView textView6 = (TextView)view.FindViewById(Resource.Id.text1);

            textView6.Text = strDate;

            for (int i = 0; i < dataSource.Count; i++)
            {
                LinearLayout lay = (LinearLayout)layoutInflater.Inflate(Resource.Layout.pulltorefreshtemplate, null);
                textView      = (TextView)lay.FindViewById(Resource.Id.text3);
                textView.Text = dataSource[i].Day;

                textView1      = (TextView)lay.FindViewById(Resource.Id.text4);
                textView1.Text = "" + (int)dataSource[i].Temperature + (char)0x00B0;

                imageView = (ImageView)lay.FindViewById(Resource.Id.imageview1);

                imageView.SetImageResource(dataSource[i].Type);

                if (i == 0)
                {
                    textView.SetTextColor(Color.ParseColor("#fbb03b"));
                    textView1.SetTextColor(Color.ParseColor("#fbb03b"));
                    imageView.SetImageResource(dataSource[i].SelectedType);
                    selectedData   = dataSource[i];
                    selectedLayout = lay;
                }
                setOnClick(lay, i);

                linearLayoutChild.AddView(lay);
            }
            pull = new SfPullToRefresh(context);
            pull.RefreshContentThreshold = 0;
            pull.PullableContent         = linearLayout;
            pull.Refreshing += (sender, e) =>
            {
                if (selectedLayout != null)
                {
                    run = new Java.Lang.Runnable(() =>
                    {
                        Java.Util.Random rnd = new Java.Util.Random();
                        int i      = rnd.NextInt(6 - 0 + 1) + 0;
                        imageView3 = (ImageView)linearLayout.FindViewById(Resource.Id.imageview);
                        imageView3.SetImageResource(dataSource[i].Type);
                        degreetext          = (TextView)linearLayout.FindViewById(Resource.Id.text);
                        String s1           = "" + dataSource[i].Temperature + (char)0x00B0 + "/12";
                        SpannableString ss3 = new SpannableString(s1);
                        ss3.SetSpan(new RelativeSizeSpan(2f), 0, 4, SpanTypes.ExclusiveExclusive);
                        degreetext.SetText(ss3, TextView.BufferType.Normal);
                        e.Refreshed = true;
                    });
                    handler.PostDelayed(run, 3000);
                }
            };
            return(pull);
        }