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 7075211
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T06:09:01+00:00 2026-05-28T06:09:01+00:00

In my WPF application, I have a table which stores the frequently used window

  • 0

In my WPF application, I have a table which stores the frequently used window names for each user. At runtiime, I make a list of it.

List<string> LstUserWindows= new List<string>();

What I need is I need to open each window depending on the names of the windows in the list. (I am using usercontrols as windows). Something like below:

 foreach (var rec in LstUserWindows)
 {
      UserControl mainUC = this.FindName(rec.MyWindow) as UserControl;
      displayUserControls(mainUC,null); 
 }
  • 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-28T06:09:01+00:00Added an answer on May 28, 2026 at 6:09 am

    I’m not sure which approach you have currently taken in storing the UserControl instances, but here are two possible approaches you could take.

    1. If all UserControl instances already exist within your UI but are simply hidden, then you should be able to use the FindName(...) (as you’ve mentioned in your question) and then change the Visibility property of the UserControl.

    2. If you have not yet loaded the UserControl instances and you want to dynamically create the control given it’s name, then you need to look into using Reflection. Using this approach, you can acquire the Type information from the Assembly and work on using Reflection to construct the object. Alternately, you could use the Activator class to construct an instance of the required control type. For that approach, you would do something like this.

      foreach (var rec in LstUserWindows)
      {
          UserControl control = (UserControl)System.Activator.CreateInstance("AssemblyName", rec);
          displayUserControls(control, null);
      }
      

    Note: I’m not sure if the parameter structure is correct (I cannot currently test it). Check out the MSDN Documentation for more help on it.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

In my WPF application I have a Canvas in which I do some drawing.
I have WPF Application where I have One main form and other user controls
I have a simple WPF application which I am trying to start. I am
I have a program in C# WPF which analyzes certain log files. Each log
I have a WPF application which tightly coupled to linq2sql through WCF. It now
I have a WPF database viewer application: It's a simple main window containing a
I have a WPF application in which I use entity framework with mysql connector/net
I have a simple application which stores the data into the sql server database
I have a WPF Application in which I am getting string someone = TextBox.text;
I have a WPF application which uses a (currently) local database to act as

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.