为何要做Viewmodel中定义控件呢?在Viewmodel定义PasswordBox的需要获得的属性,如Text,然后在view中应用绑定就可以了。
http://www.cnblogs.com/ouylvr0625/p/6962575.htmlxaml代码:CommandParameter="{Binding ElementName=pbInfo}" />ViewModel:private DelegateCommand BtnClickCommand; //申明委托BtnClickCommand = new DelegateCommand(BtnClick); //实例化private void BtnClick(PasswordBox pb){Boxer = pb;}