开发者

Adding controls dynamically to the Grid in the constructor from ViewModel

I want to add Controls dynamically from ViewModel. I have to add Button and Textbox dynamically to the Grid. In the ViewModel construct开发者_开发问答or 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


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜