mvvmlight下passwordBox绑定的解决方法
时间:2021-07-01 10:21:17
帮助过:40人阅读
Page x:Class="SGGS.SmartGroundGuidence.Pages.LoginPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:SGGS.SmartGroundGuidence.Pages"
xmlns:helper="clr-namespace:SGGS.SmartGroundGuidence.CommonHelper"
mc:Ignorable="d"
Title="LoginPage">
<Page.DataContext>
<Binding Path="LoginPage" Source="{StaticResource Locator}"></Binding>
</Page.DataContext>
<Grid VerticalAlignment="Top" Width="512" Height="417">
<Grid.Background>
<ImageBrush ImageSource="Resources/bg_login_popup.png" />
</Grid.Background>
<Grid.RowDefinitions>
<RowDefinition Height="60"></RowDefinition>
<RowDefinition Height="58"></RowDefinition>
<RowDefinition Height="20"></RowDefinition>
<RowDefinition Height="58"></RowDefinition>
<RowDefinition Height="25"></RowDefinition>
<RowDefinition Height="29"></RowDefinition>
<RowDefinition Height="60"></RowDefinition>
<RowDefinition Height="57"></RowDefinition>
<RowDefinition Height="52"></RowDefinition>
</Grid.RowDefinitions>
<StackPanel Grid.Row="1">
<Grid Height="58" Width="404">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="115*"></ColumnDefinition>
<ColumnDefinition Width="289*"></ColumnDefinition>
</Grid.ColumnDefinitions>
<TextBox Grid.Column="0" Grid.ColumnSpan="2" Style="{StaticResource SltTxtLogin}" Text="{Binding LoginUser.UserName,UpdateSourceTrigger=PropertyChanged}"/>
<Label Grid.Column="0" FontSize="18" Foreground="White" Content="用户名" VerticalAlignment="Center" HorizontalAlignment="Center"/>
</Grid>
</StackPanel>
<StackPanel Grid.Row="3">
<Grid Height="58" Width="404">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="115*"></ColumnDefinition>
<ColumnDefinition Width="289*"></ColumnDefinition>
</Grid.ColumnDefinitions>
<PasswordBox Grid.Column="0" Grid.ColumnSpan="2" Style="{StaticResource SltPwbLogin}" MaxLength="20" helper:PasswordBindingHelper.Password="{Binding Password,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"/>
<Label Grid.Column="0" FontSize="18" Foreground="White" Content="密码" VerticalAlignment="Center" HorizontalAlignment="Center"/>
</Grid>
</StackPanel>
<StackPanel Grid.Row="5">
<Grid Width="404">
<CheckBox Style="{StaticResource MyCheckBoxStyle}" HorizontalAlignment="Left" Margin="15,0,0,0" IsChecked="{x:Null}"></CheckBox>
</Grid>
</StackPanel>
<StackPanel Grid.Row="7" Orientation="Horizontal" HorizontalAlignment="Center">
<Button Style="{StaticResource StlBtnLogin}" />
<Button Style="{StaticResource StlBtnRegister}" Margin="72,0,0,0"/>
</StackPanel>
</Grid>
</Page>
剩下的Model和ViewModel以及ViewModelLocator就是MVVMLight的事了,和本文无关,记录到此。
mvvmlight下passwordBox绑定的解决方法
标签:resources sharp body metadata readonly page 绑定 str .com