Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6329627
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T17:42:21+00:00 2026-05-24T17:42:21+00:00

In Silverlight, a little box is drawn around the currently HIGHLIGHTED (NOT Selected) item

  • 0

In Silverlight, a little box is drawn around the currently HIGHLIGHTED (NOT Selected) item when you press up or down arrow or tab. I want to find out which item the little box is around so I can make it the selected item when the user presses tab. I spent three days on this, maybe someone else can use it.

       void SelectorRapidAccessKeyBehavior_DropDownOpened(object sender, EventArgs e)
        {
            FindPopup();
        }
        private void FindPopup()
        {
            CleanUpPopupHandler();
            pop = GetPopup(base.AssociatedObject);
            if (pop != null && pop.Child != null)
            {
                pop.Child.KeyDown += AssociatedObject_KeyUp;
                foreach (FrameworkElement c in Finder.FindVisualChildren<FrameworkElement>(pop.Child))
                {
                    c.KeyDown += new KeyEventHandler(c_KeyDown);
                }

            }
        }


        void c_KeyDown(object sender, KeyEventArgs e)
        {
            int t = this.AssociatedObject.TabIndex;
            Border ci = sender as Border;
            if (e.Key == Key.Tab)
            {
                if (ci != null)
                {


//this here is the magic line
                    var v = Finder.FindVisualChildren<FrameworkElement>((DependencyObject)pop.Child).Where(a => a.Opacity > 0 && a.Name == "FocusVisualElement" && a.Visibility == Visibility.Visible);//&& )
                    object o = v.First().DataContext;
                    int i = this.AssociatedObject.Items.IndexOf(o);
                    if (i > -1)
                        this.AssociatedObject.SelectedIndex = i;
                    pop.IsOpen = false;
                    DependencyObject d = Finder.FindParent<FloatableWindow>(this.AssociatedObject);
                    if (d == null)
                        d = Finder.FindParent<Window>(this.AssociatedObject);
                    Control c = Finder.FindVisualChildren<Control>(d).Where(a => a.TabIndex > t).OrderBy(a => a.TabIndex).FirstOrDefault();
                    if (c == null)
                        c = Finder.FindVisualChildren<Control>(d).OrderBy(a => a.TabIndex).FirstOrDefault();
                    if (c != null)
                        c.Focus();
                }
            }
        }
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T17:42:23+00:00Added an answer on May 24, 2026 at 5:42 pm
      void SelectorRapidAccessKeyBehavior_DropDownOpened(object sender, EventArgs e)
        {
            FindPopup();
        }
        private void FindPopup()
        {
            CleanUpPopupHandler();
            pop = GetPopup(base.AssociatedObject);
            if (pop != null && pop.Child != null)
            {
                pop.Child.KeyDown += AssociatedObject_KeyUp;
                foreach (FrameworkElement c in Finder.FindVisualChildren<FrameworkElement>(pop.Child))
                {
                    c.KeyDown += new KeyEventHandler(c_KeyDown);
                }
    
            }
        }
    
    
        void c_KeyDown(object sender, KeyEventArgs e)
        {
            int t = this.AssociatedObject.TabIndex;
            Border ci = sender as Border;
            if (e.Key == Key.Tab)
            {
                if (ci != null)
                {
    
    
    //this here is the magic line
                    var v = Finder.FindVisualChildren<FrameworkElement>((DependencyObject)pop.Child).Where(a => a.Opacity > 0 && a.Name == "FocusVisualElement" && a.Visibility == Visibility.Visible);//&& )
                    object o = v.First().DataContext;
                    int i = this.AssociatedObject.Items.IndexOf(o);
                    if (i > -1)
                        this.AssociatedObject.SelectedIndex = i;
                    pop.IsOpen = false;
                    DependencyObject d = Finder.FindParent<FloatableWindow>(this.AssociatedObject);
                    if (d == null)
                        d = Finder.FindParent<Window>(this.AssociatedObject);
                    Control c = Finder.FindVisualChildren<Control>(d).Where(a => a.TabIndex > t).OrderBy(a => a.TabIndex).FirstOrDefault();
                    if (c == null)
                        c = Finder.FindVisualChildren<Control>(d).OrderBy(a => a.TabIndex).FirstOrDefault();
                    if (c != null)
                        c.Focus();
                }
            }
        }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I currently have a little form with a silverlight bit for a person to
Silverlight does not provide perfmon counters for GC. How do i get GC Information?
I'm having a little trouble in silverlight with a databound ListBox containing databound TextBox
After toying a little with the new Silverlight 4 camera features, and being really
I've had a day full of Silverlight idiosynchrasies, including this little doozy: <ComboBox> <ComboBox.ItemContainerStyle>
I have little Silverlight app that needs to make queries to server, is it
I have little experience with silverlight development still but with the potential of silverlight
I've made a little game as an application for the web in silverlight using
I'm trying to set up UI automation for Silverlight 3. I have a little
So I have this little problem making this to work: I have silverlight client

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.