Quantcast
Channel: Windows Presentation Foundation (WPF) forum
Viewing all articles
Browse latest Browse all 18858

Load Usercontrl by name in WPF

$
0
0

Hi All,

I have a WPF page with a contne control on it. Currently I am loading the usercontrols in it, on clicks of two different buttons, in the following way :

 ContentWindow.Content = new ManageCities();

or

 ContentWindow.Content = new ManageStates();

Problem is that I want to make the concept generic and dynamic. What i mean to say is the I have one generic method for both the above calls. For this, I only have the name of the user controls as STRING i.e. "ManageCities" & "ManageStates". Can I somehow get the list of usercontrols in the folder where these are and match them with the names that I have and load them in the window. Any help is appreciated.


Viewing all articles
Browse latest Browse all 18858

Trending Articles