Example #1
0
        void PanoramaDetailPage_Loaded(object sender, RoutedEventArgs e)
        {
            var item = _itemViewModel.Item;

            if (item.IsPerson || item.IsArtist || item.IsGenre || item.IsGameGenre || item.IsMusicGenre || item.IsStudio)
            {
                _presentation.SetDefaultPageTitle();
            }
            else
            {
                DefaultTheme.Current.PageContentDataContext.SetPageTitle(item);
            }

            //Keyboard focuses the play or resume buttons once when the page is loaded
            MenuList.SelectionChanged += MenuList_SelectionChanged;
            FocusManager.AddGotFocusHandler(this, (o, args) =>
            {
                if (_isFocusFunctionButtons)
                {
                    var element = args.OriginalSource as FrameworkElement;

                    if (element != null && !element.IsKeyboardFocused && (element.Name == "BtnPlay" || element.Name == "BtnResume"))
                    {
                        Dispatcher.BeginInvoke(DispatcherPriority.Input,
                                               new Action(() => Keyboard.Focus(element)));
                    }
                }
            });
        }
        static void SelectedItemChangedCallback(DependencyObject dependencyObject, DependencyPropertyChangedEventArgs e)
        {
            var itemsControlBindingBehavior = dependencyObject as TabGroupPaneBindingBehavior;

            if (itemsControlBindingBehavior == null)
            {
                return;
            }

            foreach (var tabGroupPane in itemsControlBindingBehavior.GetAllTabGroupPanes())
            {
                FocusManager.AddGotFocusHandler(tabGroupPane, GotFocusHandler);
                var found = false;

                for (var i = 0; i < tabGroupPane.Items.Count; i++)
                {
                    var frameworkElement = tabGroupPane.Items[i] as FrameworkElement;
                    if (frameworkElement != null && frameworkElement.DataContext == e.NewValue)
                    {
                        tabGroupPane.SelectedIndex = i;
                        found = true;
                        break;
                    }
                }

                if (found)
                {
                    break;
                }
            }
        }
Example #3
0
 public LoginForm(Func <IPrincipal, bool> checker)
 {
     roleChecker = checker;
     InitializeComponent();
     FailedLoginLabel.Visibility = Visibility.Hidden;
     FocusManager.AddGotFocusHandler(this, Focus);
 }
Example #4
0
        static void SetActivePane(WorkSurfaceContextViewModel newValue)
        {
            if (_tabGroupPanes != null && _tabGroupPanes.Count > 0)
            {
                var tabGroupPane = _tabGroupPanes[0];

                foreach (var item in from object item in tabGroupPane.Items
                         let frameworkElement = item as FrameworkElement
                                                where frameworkElement != null && frameworkElement.DataContext == newValue
                                                select item)
                {
                    if (tabGroupPane.SelectedItem != item)
                    {
                        tabGroupPane.SelectedItem = item;
                        break;
                    }
                }
                FocusManager.AddGotFocusHandler(tabGroupPane, GotFocusHandler);
            }
        }
Example #5
0
 protected override void OnAttached()
 {
     base.OnAttached();
     FocusManager.AddGotFocusHandler(AssociatedObject, OnGotFocus);
 }
Example #6
0
        public TextBoxEx()
        {
            FocusManager.AddGotFocusHandler(this, GotFocusHandler);

            // FocusManager.AddLostFocusHandler(this, LostFocusHandler);
        }
Example #7
0
 public MotorPage()
 {
     InitializeComponent();
     FocusManager.AddGotFocusHandler(this, Focus);
     ConfigSel.Items = Storage.LoadAxisConfigurationsNames();
 }
Example #8
0
 public MotorPage()
 {
     InitializeComponent();
     FocusManager.AddGotFocusHandler(this, Focus);
 }
Example #9
0
 public MotionPageV2()
 {
     InitializeComponent();
     InitializeCheckGrids();
     FocusManager.AddGotFocusHandler(this, Focus);
 }