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

  • Home
  • SEARCH
  • 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 1059677
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T18:12:38+00:00 2026-05-16T18:12:38+00:00

I have some simple example WinForms code which I am trying to translate into

  • 0

I have some simple example WinForms code which I am trying to translate into WPF. The idea is to change the items within a ComboBox if a certain item is picked and drop down the ComboBox again if this happened. The WinForms code is:

 if (list.Text.Equals("C>>"))
        {
            comboBox1.Items.Clear();

            comboBox1.Items.Add("<<");
            comboBox1.Items.Add("C1");
            comboBox1.Items.Add("C2");
            comboBox1.Items.Add("C3");
            comboBox1.Items.Add("C4");
            comboBox1.Items.Add("C5");
            comboBox1.Items.Add("C6");
            comboBox1.DroppedDown = true;
        }

Although I though that this would be quite a simple change, using

    private void hotListBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
    {
        if (hotListBox.SelectedItem != null)
        {
            if (hotListBox.SelectedItem.Equals("b >>"))
            {
                hotListBox.ItemsSource = secondList;
                hotListBox.IsDropDownOpen = true;
            }
            else if (hotListBox.SelectedItem.Equals("<<"))
            {
                hotListBox.ItemsSource = initialList;
                hotListBox.IsDropDownOpen = true;

            }
            else if (hotListBox.SelectedItem.Equals("d >>"))
            {
                hotListBox.ItemsSource = thirdList;
                hotListBox.IsDropDownOpen = true;

            }
        }
    }

in WPF doesn’t seem to work in the same way. I was wondering if anyone knew how to do this?

As pointed out in comments, I should say that the items in the ComboBox update as expected, but it doesn’t drop down again in the WPF code.

Cheers,

EDIT: updated code

  • 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-16T18:12:38+00:00Added an answer on May 16, 2026 at 6:12 pm

    Change this:

    hotListBox.IsDropDownOpen = true;
    

    to this:

    Application.Current.Dispatcher.BeginInvoke(new Action(delegate
    {
         hotListBox.IsDropDownOpen = true;
    }));
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Simple example: I want to have some items on a page (like divs or
i have some WinForms app (Framework to develop some simple apps), written in C#.
i have some WinForms app (Framework to develop some simple apps), written in C#.
I have some VERY simple code to return the title for a section header:
A simple example. alt text http://img19.imageshack.us/img19/1854/51445300.jpg A have a class TDMReader which is a
I have some simple scripts that allow me to change where certain versions of
Take a simple example: I'm working on the default branch, have some changesets committed
i have some simple question. 1-how can i change php pages in a specify
i have some simple code that does a preg match: $bad_words = array('dic', 'tit',
I have some simple shell scripting tasks that I want to do For example:

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.