1

I want to add Controls dynamically from ViewModel. I have to add Button and Textbox dynamically to the Grid. In the ViewModel constructor call I need to add the controls. I am not getting how to get the Grid control reference in my ViewModel. Can anybody help me on this? Thanks in advance

1 Answer 1

3

That would be the wrong way. Your ViewModel should not be directly aware of the View.

You could create a UserControl (or maybe a template) for your Button+TextBox and bind it to a property (or List) of a specialized ViewModel on your main ViewModel.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.