将参数传递给xbind事件处理程序
问题描述:
在WPF应用程序中,我有一个登录命令,它接受SecureString
作为参数。我使用了一个xaml转换器将密码框中的值传递给该命令。将参数传递给xbind事件处理程序
<PasswordBox
Name="PasswordBox"
Grid.Row="2"
Grid.Column="2" />
<Button
Grid.Row="3"
Grid.Column="3"
Command="{Binding LoginCommand}"
Content="{x:Static p:Resources.LoginView_LoginButtonContent}">
<Button.CommandParameter>
<MultiBinding
Converter="{c:PasswordBoxConverter}"
Mode="TwoWay"
UpdateSourceTrigger="PropertyChanged">
<Binding ElementName="PasswordBox" />
</MultiBinding>
</Button.CommandParameter>
</Button>
我想使用xbind在UWP中做类似的事情。你可以使用xbind将参数传递给事件处理程序吗?
答
UWP应用程序不支持多重绑定,并且您不能使用xbind传递事件处理程序。 绑定是为强类型对象,你需要找到另一种方式来做到这一点。
使用UWP,您可以直接绑定到WPF中控件的密码属性是不可能的。
这样的:
<PasswordBox
Margin="0,12,0,0"
Header="Contraseña"
Password="{Binding Password, Mode=TwoWay}"
PasswordRevealMode="Peek"
PlaceholderText="Escribe tu contraseña" />
问候