Esempio n. 1
0
        private void PreviewEscapeTabKeyDown(KeyEventArgs e)
        {
            Popup.IsOpen = false;
            SearchTextBoxControl.Clear();

            if (e.Key == Key.Tab)
            {
                Frame    parent = GlobalUtils.FindVisualParent <Frame>(this);
                Selector child  = GlobalUtils.FindVisualChildren <Selector>(parent).FirstOrDefault();

                if (child != null)
                {
                    parent.Focusable = true;
                    child.Focus();
                    parent.Focusable = false;
                }
            }
        }
Esempio n. 2
0
        private void AutoRepositionPopupBehavior()
        {
            UserControl parent = GlobalUtils.FindVisualParent <UserControl>(this);
            Window      window = Window.GetWindow(parent);

            if (window != null || this == null)
            {
                window.LocationChanged += (s, t) =>
                {
                    var offset = HorizontalOffset;

                    HorizontalOffset = offset + 1;
                    HorizontalOffset = offset;
                };
            }

            PlacementTarget = parent;
        }