【问题标题】:Pass parameter to xbind event handler将参数传递给 xbind 事件处理程序
【发布时间】:2017-02-16 17:03:52
【问题描述】:

在 WPF 应用程序中,我有一个接受 SecureString 作为参数的登录命令。我使用 xaml 转换器将密码框中的值传递给命令。

<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>

我想在 UWP 中使用 xbind 做类似的事情。可以用 xbind 将参数传递给事件处理程序吗?

【问题讨论】:

    标签: c# xaml uwp xbind


    【解决方案1】:

    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" />
    

    最好的问候

    【讨论】:

      猜你喜欢
      • 2012-08-30
      • 2021-05-30
      • 2011-05-02
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多