我有一个MVVM运行树视图.在顶层是包含凭据的Account对象.我有一个PasswordBox,可用于更改帐户密码,后面有一个Save按钮.代码如下,是帐户级别模板的一部分:
PasswordBox Width="100" x:Name="pbPassword"/>
Button x:Name="btnSave" Command="{Binding ClickCommand}" CommandParameter="{Binding ElementName=pbPassword, Path=Password}" Height="20" Width="50">Save
PasswordBox Width="100" x:Name="pbPassword"/>
Button x:Name="btnSave" Command="{Binding ClickCommand}" CommandParameter="{Binding ElementName=pbPassword, Path=Password}" Height="20" Width="50">Save
PasswordBox Width="100" x:Name="pbPassword"/>
Button x:Name="btnSave" Command="{Binding ClickCommand}" CommandParameter="{Binding ElementName=pbPassword, Path=Password}" Height="20" Width="50">Save
我在PasswordBox中添加了一些内容,然后单击"保存".触发ClickCommand,但参数始终为string.Empty.我错过了什么?