コード例 #1
0
 protected override void OnAttachedTo(ContentPage bindable)
 {
     ListView        = bindable.FindByName <SfListView>("listView");
     button          = bindable.FindByName <Button>("Button");
     scrollview      = ListView.GetScrollView();
     button.Clicked += Button_Clicked;
     base.OnAttachedTo(bindable);
 }
コード例 #2
0
 protected override void OnAttachedTo(BindableObject bindable)
 {
     listView               = bindable as SfListView;
     searchBar              = (bindable as SfListView).FindByName <SearchBar>("filterText");
     searchBar.TextChanged += SearchBar_TextChanged;
     scrollview             = listView.GetScrollView();
     base.OnAttachedTo(bindable);
 }
コード例 #3
0
 protected override void OnDetachingFrom(SfListView bindable)
 {
     base.OnDetachingFrom(bindable);
     scrollview.Scrolled -= Scrollview_Scrolled;
     container            = null;
     scrollview           = null;
     listview             = null;
 }
コード例 #4
0
 protected override void OnAttachedTo(SfListView bindable)
 {
     base.OnAttachedTo(bindable);
     listview  = bindable as SfListView;
     viewModel = new ViewModel();
     listview.BindingContext = viewModel;
     container            = listview.GetVisualContainer();
     scrollview           = listview.GetScrollView();
     scrollview.Scrolled += Scrollview_Scrolled;
 }
コード例 #5
0
 private void SetScrollStatus(ExtendedScrollView view)
 {
     try
     {
         this.ScrollEnabled = view.ScrollingEnabled;
     }
     catch (Exception ex)
     {
         System.Diagnostics.Debug.WriteLine(ex.Message);
     }
 }
コード例 #6
0
 public SettingTabView()
 {
     InitializeComponent();
     BindingContext = viewModel;
     UpdateSettingItem();
     viewModel.heightImages = 150;
     this.listView.DragDropController.UpdateSource = true;
     container            = listView.GetVisualContainer();
     scrollview           = listView.GetScrollView();
     scrollview.Scrolled += Scrollview_Scrolled;
 }
コード例 #7
0
 private void SetScrollBarStatus(ExtendedScrollView view)
 {
     try
     {
         this.ShowsVerticalScrollIndicator   = view.ScrollBarEnabled;
         this.ShowsHorizontalScrollIndicator = view.ScrollBarEnabled;
     }
     catch (Exception ex)
     {
         System.Diagnostics.Debug.WriteLine(ex.Message);
     }
 }
コード例 #8
0
        /// <summary>
        /// Initializes a new instance of the <see cref="ExtendedScrollViewPage"/> class.
        /// </summary>
        public ExtendedScrollViewPage()
        {
            InitializeComponent();

            var container = new StackLayout()
            {
                HorizontalOptions = LayoutOptions.FillAndExpand,
                VerticalOptions   = LayoutOptions.FillAndExpand
            };

            var buttonToScroll = new Button()
            {
                Text = "Scroll to end"
            };

            container.Children.Add(buttonToScroll);

            for (var i = 0; i < 10; i++)
            {
                container.Children.Add(new Image
                {
                    Aspect        = Aspect.AspectFill,
                    Source        = ImageSource.FromUri(new Uri("http://www.stockvault.net/data/2011/05/31/124348/small.jpg")),
                    HeightRequest = IMAGE_HEIGHT
                });
            }
            var sv = new ExtendedScrollView
            {
                Content           = container,
                HorizontalOptions = LayoutOptions.FillAndExpand,
                VerticalOptions   = LayoutOptions.FillAndExpand
            };

            sv.Scrolled += async(arg1, arg2) =>
            {
                if (!(arg2.Y > sv.Bounds.Height) || _displayAlert)
                {
                    return;
                }

                _displayAlert = true;
                await DisplayAlert("Scroll event", "User scrolled pass bounds", "Ok", "cancel");
            };

            buttonToScroll.Clicked += (sender, e) =>
            {
                sv.Position = new Point(sv.Position.X, sv.ContentSize.Height - IMAGE_HEIGHT);
            };

            Content = sv;
        }
コード例 #9
0
        protected override void OnElementChanged(VisualElementChangedEventArgs e)
        {
            base.OnElementChanged(e);

            this.Scrolled += (sender, ev) => {
                ExtendedScrollView sv = (ExtendedScrollView)Element;
                sv.UpdateBounds(this.Bounds.ToRectangle());
            };

            if (e.OldElement != null)
            {
                e.OldElement.PropertyChanged -= OnElementPropertyChanged;
            }
            e.NewElement.PropertyChanged += OnElementPropertyChanged;
        }
コード例 #10
0
        protected void OnElementPropertyChanged(object sender, PropertyChangedEventArgs e)
        {
            if (e.PropertyName == ExtendedScrollView.PositionProperty.PropertyName)
            {
                ExtendedScrollView sv = (ExtendedScrollView)Element;
                Point pt = sv.Position;

                if (System.Math.Abs(this.Bounds.Location.Y - pt.Y) < EPSILON &&
                    System.Math.Abs(this.Bounds.Location.X - pt.X) < EPSILON)
                {
                    return;
                }

                this.ScrollRectToVisible(
                    new RectangleF((float)pt.X, (float)pt.Y, Bounds.Width, Bounds.Height), sv.AnimateScroll);
            }
        }
コード例 #11
0
        private void rightImage_BindingContextChanged(object sender, EventArgs e)
        {
            Image              rightImage         = sender as Image;
            Grid               grid1              = (Grid)rightImage.Parent;
            Grid               grid2              = (Grid)grid1.Parent;
            Grid               grid3              = (Grid)grid2.Parent;
            SwipeView          swipeView          = (SwipeView)grid3.Parent;
            VisualContainer    visualContainer    = (VisualContainer)swipeView.Parent;
            ExtendedScrollView extendedScrollView = (ExtendedScrollView)visualContainer.Parent;
            SfListView         sfListView         = (SfListView)extendedScrollView.Parent;
            Collection <Lado>  Source             = (Collection <Lado>)sfListView.ItemsSource;
            Lado               item = Source[itemIndex];

            DeleteEvent evento = new DeleteEvent(item);

            evento.executeEvent += Evento_executeEvent;
            (rightImage.Parent as View).GestureRecognizers.Clear();
            (rightImage.Parent as View).GestureRecognizers.Add(new TapGestureRecognizer()
            {
                Command = evento
            });
            rightImage.Source = "Delete.png";
        }