Exemplo n.º 1
0
        public void PageLoaded(object o, EventArgs e)
        {
            // set focus
            paper.MouseLeftButtonDown += delegate { textBox.Focus(); };
            textBox.LostFocus += textbox_LostFocus;
            textBox.GotFocus += delegate { paper.ShowCaret = true; };
            textBox.Focus();
            textBox.KeyDown += Controller.Instance.KeyDown;
            textBox.KeyUp += Controller.Instance.KeyUp;

            // support mouse wheel scrolling
            var scroller = new MouseWheelHelper(ScrollViewerRoot);
            scroller.Moved += (delta) =>
              	{
              		if (delta < 0)
              		{
                    if (ScrollViewerRoot.ScrollableHeight > ScrollViewerRoot.VerticalOffset)
                        ScrollViewerRoot.ScrollToVerticalOffset(ScrollViewerRoot.VerticalOffset + 40);
              		}
              		else
              		{
                    if (0 < ScrollViewerRoot.VerticalOffset)
                        ScrollViewerRoot.ScrollToVerticalOffset(ScrollViewerRoot.VerticalOffset - 40);
              		}
              	};

            // reset paper
            paper.Children.Clear();
            paper.Children.Add(new PaperLine());
        }
Exemplo n.º 2
0
        public void PageLoaded(object o, EventArgs e)
        {
            // wires the scrollbar event - see WireScrollBarEvent to know how MSFT is making everybody's life difficult by sealing controls
            LayoutUpdated += WireScrollBarEvent;

            // set focus
            paper.MouseLeftButtonDown += (s, ea) => textBox.Focus();
            textBox.GotFocus += (s, ea) => { paper.ShowCaret = true; };
            textBox.LostFocus += TextBoxLostFocus;
            textBox.Focus();
            textBox.KeyDown += Controller.Instance.KeyDown;
            textBox.KeyUp += Controller.Instance.KeyUp;

            // support mouse wheel scrolling
            var scroller = new MouseWheelHelper(ScrollViewerRoot);
            scroller.Moved += MouseWheelScrolled;

            // reset paper
            paper.Children.Clear();
            paper.Children.Add(new PaperLine());
        }