简体   繁体   中英

Pass parameter to xbind event handler

In a WPF application, I had a login command that accepted a SecureString as a parameter. I used a xaml converter to pass the value from a password box to the command.

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

I would like to do something similar in UWP using xbind. Can you pass parameters to an event handler with xbind?

UWP apps does not support Multibinding and you can not pass the event handler with xbind. Bind is for strong typed objects you will need to find another way to do that.

With UWP you can do a Binding directly to the Password Property of the control in WPF is not possible.

like this:

   <PasswordBox
                    Margin="0,12,0,0"
                    Header="Contraseña"
                    Password="{Binding Password, Mode=TwoWay}"
                    PasswordRevealMode="Peek"
                    PlaceholderText="Escribe tu contraseña" />

Best Regards

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM