簡體   English   中英

將參數傳遞給xbind事件處理程序

[英]Pass parameter to xbind event handler

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

我想使用xbind在UWP中做類似的事情。 您可以使用xbind將參數傳遞給事件處理程序嗎?

UWP應用程序不支持多重綁定,並且您不能通過xbind傳遞事件處理程序。 綁定是針對強類型對象的,您將需要找到另一種方法。

使用UWP,您可以直接綁定到WPF中控件的Password屬性。

像這樣:

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

最好的祝福

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM