2012-10-10 21 views

Respuesta

0

Quizás, intente editar la plantilla de control de phonetextbox. reemplace el cuadro de texto con passwordbox.

y se puede obtener un phonetextbox edición PasswordBox, LOL

+0

Lo probé. Se produjo un error inesperado bloqueos –

3

Otra opción: WindowsPhoneControls

Además, la próxima versión de los controles de Telerik WP tiene un RadPasswordTextBox.

0

En Windows Phone 8 utilizando Windows Phone Toolkit

En Xaml

<Grid Grid.Row="1" Margin="12,0,0,0" x:Name="ContentPanel">    
     <toolkit:PhoneTextBox Height="72" Margin="0,0,0,270" TextWrapping="Wrap" VerticalAlignment="Bottom" Hint="{Binding LocalizedResources.LblUser, Source={StaticResource LocalizedStrings}}" x:Name="txtUser" /> 
     <toolkit:PhoneTextBox Height="72" Margin="0,0,0,210" TextWrapping="Wrap" Hint="{Binding LocalizedResources.LblPassword, Source={StaticResource LocalizedStrings}}" x:Name="txtPasswordPlace" VerticalAlignment="Bottom" IsReadOnly="True" />    
     <PasswordBox Margin="0,72,0,210" VerticalAlignment="Bottom" x:Name="txtPassword" LostFocus="PasswordLostFocus" GotFocus="PasswordGotFocus" Opacity="0"/> 
     <Button x:Name="btnLogin" Content="{Binding LocalizedResources.LblStartSession, Source={StaticResource LocalizedStrings}}" Click="BtnLogin_Click" VerticalAlignment="Bottom" Margin="0,0,0,150" />    
    </Grid 

ES C#

public void CheckPasswordWatermark() 
    { 
     var passwordEmpty = string.IsNullOrEmpty(txtPassword.Password); 
     txtPasswordPlace.Opacity = passwordEmpty ? 100 : 0; 
     txtPassword.Opacity = passwordEmpty ? 0 : 100; 
    } 

    private void PasswordGotFocus(object sender, RoutedEventArgs e) 
    { 
     txtPasswordPlace.Opacity = 0; 
     txtPassword.Opacity = 100; 
    } 

    private void PasswordLostFocus(object sender, RoutedEventArgs e) 
    { 
     CheckPasswordWatermark(); 
    } 

Codificación feliz!

Cuestiones relacionadas