c# - How might you add user controls to a window dynamically -


I have a program that I am taking from behind the code and converting to MVVM. The program is very simple, it takes text from the text box and converts the string into a pipe delaminated text file. My program has a MainViewWindow and 3 user controllers that use a Modern UI tab system to determine which user control populates MainViewWindow, I am currently working on the first user control. Which user control I have chosen and I am using a simple icon (viewloaded lolochter) to identify "active" on the menuwindows. User control has ~ 30 text boxes that are bound to view modal. Some of these text boxes contain buttons that activate a pop-up window that asks for additional information. For example, in the 'Name:' text box, he has a button which should pop up the window that asks for different names, last names, middle names, suffixes and prefixes, in separate text boxes. This information is parsed into a string and is separated through the '^' symbol and placed back in the 'Name:' text box. It will not be difficult, but I want to provide meat and potatoes.

About my problem I have 8 places where I need a button to pop up the 'Additional Information' window. All of these are required for different information, so I have created user controls with the required fields. When the button is pushed then I want to dynamically add it to this pop-up window. I do not know how to pop up a window and by connecting a user control in the window it is essentially research and consistent with my logic based MVVM framework through commanding. If I'm on the right track (I'm sure hopefully!) Can fill a gap? If there is a better way, tell me in the right direction?

What I think, you will need to create a new form and then call it from the button .

Once this form comes up, you can dynamically add that control that is suitable for that button.

There is a button code to show the additional form:

  Private Zero Button 1_Click (Object Sender, EventArgs e) {PopupForm Form = New Popup Form (); Form.ShowDialog (); }  

I will not provide the full code for you, but will dynamically create a control and actually use it, you will need the following information

  Control Type control space control size control  

Once the form is loaded, it should call some ways that will control the answer to this question:


Comments

Popular posts from this blog

import - Python ImportError: No module named wmi -

Editing Python Class in Shell and SQLAlchemy -

c# - MySQL Parameterized Select Query joining tables issue -