コード例 #1
0
        /// <summary>
        /// 添加已选对象
        /// </summary>
        /// <param name="item"></param>
        private void AddSelectedItem(RoomStateModel item, int Index = -1)
        {
            Xamarin.Forms.TemplatedView view = new Xamarin.Forms.TemplatedView();
            view.ControlTemplate = _ctControlTemplate;
            view.BindingContext  = item;

            if (Index != -1)
            {
                _spList.Children.Insert(Index, view);
            }
            else
            {
                _spList.Children.Add(view);
            }
        }
コード例 #2
0
        /// <summary>
        /// 添加已选对象
        /// </summary>
        /// <param name="item"></param>
        private void AddSelectedItem(MainListModel item, int Index = -1)
        {
            Xamarin.Forms.TemplatedView view = new Xamarin.Forms.TemplatedView();
            view.ControlTemplate = _ctControlTemplate;
            view.BindingContext  = item;

            if (Index != -1)
            {
                view.IsVisible = true;
            }
            else
            {
                _spList.Children.Add(view);
            }
        }
コード例 #3
0
        /// <summary>
        /// 添加已选对象
        /// </summary>
        /// <param name="item"></param>
        private void AddSelectedItem(RoomStateModel item, int Index = -1)
        {
            Xamarin.Forms.TemplatedView view = null;
            if (tempTemplateViewList.Count > 0)
            {
                view                = tempTemplateViewList.Pop();
                view.IsVisible      = true;
                view.BindingContext = item;
            }
            else
            {
                view = new Xamarin.Forms.TemplatedView();
                view.ControlTemplate = _ctControlTemplate;

                view.BindingContext = item;
                _spList.Children.Add(view);
            }
        }
コード例 #4
0
        /// <summary>
        /// 删除已选
        /// </summary>
        /// <param name="item"></param>
        private void RemoveSelected(MainListModel item)
        {
            Lists.Remove(item);

            Xamarin.Forms.TemplatedView _view = null;
            foreach (Xamarin.Forms.TemplatedView items in this._spList.Children)
            {
                if (items.BindingContext == item)
                {
                    _view = items;
                    break;
                }
            }

            if (null != _view)
            {
                _view.IsVisible = false;
            }
        }
コード例 #5
0
        /// <summary>
        /// 删除已选
        /// </summary>
        /// <param name="item"></param>
        private void RemoveSelected(RoomStateModel item)
        {
            RoomLists.Remove(item);

            Xamarin.Forms.TemplatedView _view = null;
            foreach (Xamarin.Forms.TemplatedView items in this._spList.Children)
            {
                if (items.BindingContext == item)
                {
                    _view = items;
                    break;
                }
            }

            if (null != _view)
            {
                _view.BindingContext = null;
                this._spList.Children.Remove(_view);
            }
        }
コード例 #6
0
        /// <summary>
        /// 替换
        /// </summary>
        /// <param name="index"></param>
        /// <param name="oldItem"></param>
        /// <param name="newItem"></param>
        private void ReplaceSelected(int index, RoomStateModel oldItem, RoomStateModel newItem)
        {
            RoomLists.Remove(oldItem);

            Xamarin.Forms.TemplatedView _view = null;
            foreach (Xamarin.Forms.TemplatedView items in this._spList.Children)
            {
                if (items.BindingContext == oldItem)
                {
                    _view = items;
                    break;
                }
            }


            newItem.GoCommand = this.GoCommand;
            RoomLists.Insert(index, newItem);
            if (null != _view)
            {
                _view.BindingContext = null;
                _view.BindingContext = newItem;
            }
        }
コード例 #7
0
        /// <summary>
        /// 删除已选
        /// </summary>
        /// <param name="item"></param>
        private void RemoveSelected(RoomStateModel item)
        {
            Xamarin.Forms.TemplatedView _view = null;
            foreach (Xamarin.Forms.TemplatedView items in this._spList.Children)
            {
                if (items.BindingContext == item)
                {
                    _view = items;
                    break;
                }
            }

            if (null != _view)
            {
                _view.BindingContext = null;
                if (!tempTemplateViewList.Contains(_view))
                {
                    tempTemplateViewList.Push(_view);
                }
                _view.IsVisible = false;
            }

            RoomList.Remove(item);
        }
コード例 #8
0
        public TemplatedViewHandler(NativeComponentRenderer renderer, XF.TemplatedView templatedViewControl) : base(renderer, templatedViewControl)
        {
            TemplatedViewControl = templatedViewControl ?? throw new ArgumentNullException(nameof(templatedViewControl));

            Initialize(renderer);
        }