Example #1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="NControl.Controls.ExpandableActionButton"/> class.
        /// </summary>
        public ExpandableActionButton()
        {
            // Set direction
            Direction = ExpandDirection.Up;

            // Layout
            Content = new RelativeLayout();

            // Main button
            _mainButton = new ToggleActionButton {
                ButtonIcon = FontAwesomeLabel.FAEllipsisV,
            };

            // Create buttons layout
            _buttonsLayout = new RelativeLayout();
            (Content as RelativeLayout).Children.Add(_buttonsLayout, () => (Content as RelativeLayout).Bounds);

            AddButtonToLayout(_mainButton, Content as RelativeLayout);

            _mainButton.PropertyChanged += async(object sender, System.ComponentModel.PropertyChangedEventArgs e) => {
                if (e.PropertyName == ToggleActionButton.IsToggledProperty.PropertyName)
                {
                    // Show/Hide buttons
                    if (_mainButton.IsToggled)
                    {
                        await ShowButtonsAsync();
                    }
                    else
                    {
                        await HideButtonsAsync();
                    }
                }
            };
        }
		/// <summary>
		/// Initializes a new instance of the <see cref="NControl.Controls.ExpandableActionButton"/> class.
		/// </summary>
		public ExpandableActionButton ()
		{
		    // Set direction
			Direction = ExpandDirection.Up;

			// Layout
			Content = new RelativeLayout();

			// Main button
			_mainButton = new ToggleActionButton {
				ButtonIcon = FontAwesomeLabel.FAEllipsisV,
			};
				
			// Create buttons layout
			_buttonsLayout = new RelativeLayout ();
			(Content as RelativeLayout).Children.Add (_buttonsLayout, () => (Content as RelativeLayout).Bounds);

			AddButtonToLayout (_mainButton, Content as RelativeLayout);

			_mainButton.PropertyChanged += async (object sender, System.ComponentModel.PropertyChangedEventArgs e) => {
				if(e.PropertyName == ToggleActionButton.IsToggledProperty.PropertyName)
				{
					// Show/Hide buttons
					if(_mainButton.IsToggled)
						await ShowButtonsAsync();
					else
						await HideButtonsAsync();
				}
			};
		}