/// <summary>
        /// Gets the X offset of the specified button.
        /// </summary>
        /// <param name="button">The button to retrieve the X offset from.</param>
        /// <returns></returns>
        private double GetVisualOffsetX(HorizontalMenuButton button)
        {
            // Return the offset vector for the TextBlock object.
            Vector vector = VisualTreeHelper.GetOffset(button);

            // Convert the vector to a point value.
            Point currentPoint = new Point(vector.X, vector.Y);

            return(currentPoint.X);
        }
        /// <summary>
        /// Fires when a <see cref="HorizontalMenuButton"/> is clicked.
        /// </summary>
        private void HorizontalMenuButton_Click(object sender, EventArgs e)
        {
            // Sets all button's IsSelected property to false.
            foreach (HorizontalMenuButton button in buttons)
            {
                button.IsSelected = false;
            }

            HorizontalMenuButton bttn = (HorizontalMenuButton)sender;

            bttn.IsSelected = true;

            // Gets the X offset of the clicked button.
            var    btn     = sender as HorizontalMenuButton;
            double xOffset = GetVisualOffsetX(btn);

            // Stores the clicked buttons offset.
            selectedButtonOffset = xOffset;

            MoveBorder(xOffset);
        }