protected override void OnButtonDown(Microsoft.SPOT.Input.ButtonEventArgs e)
        {
            if (e.Button == Button.VK_DOWN && _selectedIndex < Items.Count - 1)
            {
                int newIndex = _selectedIndex + 1;
                while (newIndex < Items.Count && !Items[newIndex].IsSelectable)
                {
                    newIndex++;
                }

                if (newIndex < Items.Count)
                {
                    SelectedIndex = newIndex;
                    ScrollIntoView(SelectedItem);
                    e.Handled = true;
                }
            }
            else if (e.Button == Button.VK_UP && _selectedIndex > 0)
            {
                int newIndex = _selectedIndex - 1;
                while (newIndex >= 0 && !Items[newIndex].IsSelectable)
                {
                    newIndex--;
                }

                if (newIndex >= 0)
                {
                    SelectedIndex = newIndex;
                    ScrollIntoView(SelectedItem);
                    e.Handled = true;
                }
            }
        }
Exemple #2
0
        protected override void OnButtonDown(Microsoft.SPOT.Input.ButtonEventArgs e)
        {
            if (e.Button == Button.VK_UP || e.Button == Button.VK_DOWN)
            {
                bool isUp = (e.Button == Button.VK_UP);
                switch (_scrollingStyle)
                {
                case ScrollingStyle.PageByPage:
                    e.Handled = PageScroll(isUp);
                    break;

                case ScrollingStyle.LineByLine:
                    e.Handled = LineScroll(isUp);
                    break;

                default:
                    Debug.Assert(false, "Unknown ScrollingStyle");
                    break;
                }
            }
        }