I want to use Reflection to fill my Checkboxes dynamically.
I found an helping answer here
And used it in my Code:
    public static List<System.Type> getModuleList()
    {
        // fill with all Classes in Timestamp.View.UserControls.ModuleView per Reflection
        List<System.Type> theList = Assembly.GetExecutingAssembly().GetTypes()
                              .Where(t => t.Namespace == "Timestamp.View.UserControls.ModuleView")
                              .ToList();
        return theList;
    }
I filled my Checkboxes like:
   foreach (System.Type type in ModuleController.getModuleList())
        {
            cbModule1.Items.Add(type);
            cbModule2.Items.Add(type);
            cbModule3.Items.Add(type);
            cbModule4.Items.Add(type);
        }
- Now i want to create a new Instance of the SelectedType - private void CbModule4_SelectionChanged(object sender, SelectionChangedEventArgs e) { ucModul4.Content = //new Instance of Selected Item }
I could use Reflection to create a new Instance, but I dont know how.
- I want to give every Class a String which will be shown as Item in the Checkbox. Is this possible, or do I need a Method to find a Class by its String?
EDIT: I need to argue why my question differs from this one
So first of all this question could only solve one of my Problems, but i found it earlier and it didn't helped me. I don't know how to get the type of the list and how i can give the class an alias.
 
     
    