Thanks Advance. I learning to dev a uwp program. I get those code in internet
I have a login view:
<TextBox x:Name="txtUserID" Grid.Row="0" Grid.Column="1" Width="150" Text="{x:Bind VM.UserId,Mode=TwoWay}" />
<TextBlock x:Name="txbUserName" Grid.Row="1" Grid.Column="1" Width="150" Text="{x:Bind VM.UserName,Mode=OneWay}" />
<Button x:Name="btnLogin" Content="{x:Bind VM.log, Mode=OneWay}" Grid.Row="2" Grid.ColumnSpan="2" Width="150" HorizontalAlignment="Center"
Command="{x:Bind VM.LoginCommand,Mode=OneWay}"
CommandParameter="{Binding Text,ElementName=txtUserID,Mode=OneWay}"
/>
Then I have a command for button:
public DelegateCommand<string> LoginCommand
{
get
{
return _loginCommand
?? (_loginCommand = new DelegateCommand<string>(
s =>
{
UserName = s;
log = "new";
},
s => !string.IsNullOrEmpty(s)
));
}
}
Of course, this program works fine, but I don’t quite understand it.
Except for S, all variables are declared, but S does not.
But the strange thing is that S does not declare, but it can correctly get the parameters carried by the button.
And I renamed S and the effect is still in effect.
I don't quite understand this, I hope someone can help me.