Пример #1
0
        protected override void OnElementChanged(VisualElementChangedEventArgs e)
        {
            base.OnElementChanged(e);

            if (refreshControl != null)
            {
                return;
            }

            if (Element == null)
            {
                return;
            }

            Element.PropertyChanged += Element_PropertyChanged;
            refreshControl           = new FormsUIRefreshControl();

            CustomScrollView customScrollView = (Element as CustomScrollView);

            if (customScrollView != null)
            {
                refreshControl.RefreshCommand = customScrollView.RefreshCommand;
                Bounces = !customScrollView.DisableBounces;
            }

            AlwaysBounceVertical = true;
            AddSubview(refreshControl);
        }
 protected override void OnElementChanged(VisualElementChangedEventArgs e)
 {
     base.OnElementChanged(e);
     if (e.NewElement == null)
     {
         return;
     }
     currentScrollView             = (CustomScrollView)e.NewElement;
     e.NewElement.PropertyChanged += ElementPropertyChanged;
 }
Пример #3
0
    void OnEnable ()
	{
		mTrans = transform;

        if (ScrollView == null && draggablePanel != null)
		{
			ScrollView = draggablePanel;
			draggablePanel = null;
		}
		FindScrollView();
	}
Пример #4
0
	void FindScrollView ()
	{

        var sv = NGUITools.FindInParents<CustomScrollView>(mTrans);

		if (ScrollView == null)
		{
			ScrollView = sv;
			mAutoFind = true;
		}
		else if (ScrollView == sv)
		{
			mAutoFind = true;
		}
		mScroll = ScrollView;
	}
Пример #5
0
    void Awake()
    {
        m_listData = new List<string>();

        defaultVec = new Vector3(0, m_cellHeight, 0);

        mDrag = NGUITools.FindInParents<CustomScrollView>(gameObject);

        m_height = mDrag.panel.height;
		Debug.Log (m_height);

        m_maxLine = Mathf.CeilToInt(m_height / m_cellHeight) + 1;

        m_cellList = new Item[m_maxLine];

        CreateItem();
    }
Пример #6
0
    void Awake()
    {
        defaultVec = new Vector3(0, CellHeight, 0); 

        mDrag = NGUITools.FindInParents<CustomScrollView>(gameObject);

        m_height = mDrag.GetComponent<UIPanel>().height;

        m_maxLine = Mathf.CeilToInt(m_height / CellHeight) + 1;

        m_cellList = new WrapItemBase[m_maxLine];
        if (ShowBg)
        {
            m_bgList = new Transform[m_maxLine];
        }
        CreateItem();
        lastY = mDrag.transform.localPosition.y;
    }
Пример #7
0
    void OnPress (bool pressed)
	{
		if (mAutoFind && mScroll != ScrollView)
		{
			mScroll = ScrollView;
			mAutoFind = false;
		}

		if (ScrollView && enabled && NGUITools.GetActive(gameObject))
		{
			ScrollView.Press(pressed);
			
			if (!pressed && mAutoFind)
			{
                ScrollView = NGUITools.FindInParents<CustomScrollView>(mTrans);
				mScroll = ScrollView;
			}
		}
	}
Пример #8
0
        void InitView()                 // Initialize View
        {
            Container = new StackLayout()
            {
                Spacing = 40, Padding = new Thickness(50, 10, 50, 10), Margin = 0, HorizontalOptions = LayoutOptions.CenterAndExpand, VerticalOptions = LayoutOptions.StartAndExpand, Orientation = StackOrientation.Horizontal
            };

            tap_tabgesture.Tapped += (sender, e) =>
            {
                var selected_tab = sender as Label;

                if (Container.Children.Contains(selected_tab))
                {
                    var index = Container.Children.IndexOf(selected_tab);
                    SelectedIndex = index;
                }
            };

            slider = new BoxView {
                HeightRequest = 5, Color = (Color)Application.Current.Resources["Squash"], WidthRequest = 5, HorizontalOptions = LayoutOptions.Start, VerticalOptions = LayoutOptions.End, Margin = 0
            };

            var main_Container = new StackLayout {
                Orientation       = StackOrientation.Vertical,
                Spacing           = 4,
                HorizontalOptions = LayoutOptions.FillAndExpand,
                VerticalOptions   = LayoutOptions.FillAndExpand, Children = { Container, slider }, Padding = 0, Margin = 0
            };

            scrollview = new CustomScrollView {
                Orientation = ScrollOrientation.Horizontal, BackgroundColor = (Color)Application.Current.Resources["turquoiseBlue"], Content = main_Container, HorizontalOptions = LayoutOptions.FillAndExpand,
                Padding     = 0, Margin = 0
            };

            Content = scrollview;
        }