Ejemplo n.º 1
0
        internal void Bind(
            ListView listView,
            object item)
        {
            if (null == listView)
            {
                throw new ArgumentNullException(nameof(listView));
            }

            this.ListView = listView;
            this.Item     = item;

            // Reset command bar
            this.IsCommandBarVisible = false;
            if (this._commandBarCommands != this.ListView.CommandBarCommands)
            {
                this._commandBar.SetCommands(this.ListView.CommandBarCommands);
                this._commandBarCommands = this.ListView.CommandBarCommands;
            }
            this._commandBar.BindingContext = item;

            // Reset swipe defaults
            this._swipeItem.StopAnimation();
            this._swipeItem.Translation = Point.Zero;
            this._contentLayout.StopAnimation();
            this._contentLayout.Translation = Point.Zero;
        }
Ejemplo n.º 2
0
        internal virtual void SetCommands(
            CommandBarCommandCollection commands)
        {
            if (null == commands)
            {
                if ((this._primaryButtons.Count == 0) && (this._secondaryButtons.Count == 0))
                {
                    return;
                }

                throw new NotSupportedException();
            }

            if ((this._primaryButtons.Count != 0) || (this._secondaryButtons.Count != 0))
            {
                throw new NotImplementedException();
            }

            foreach (var command in commands.PrimaryCommands)
            {
                this._primaryButtons.Add(new CommandBarButton()
                {
                    Text    = command.Text,
                    Icon    = command.Icon,
                    Command = command.Command,
                });
            }

            foreach (var command in commands.SecondaryCommands)
            {
                this._secondaryButtons.Add(new CommandBarButton()
                {
                    Text    = command.Text,
                    Icon    = command.Icon,
                    Command = command.Command,
                });
            }
        }