콘텐츠 대화 상자가있는 pivotitem 내에 passwordbox를 구현하려고합니다. pointerpressed를 사용하여 pivotitem을 클릭하면 암호 대화 상자를 트리거하는 데 적합한 지 알고 싶습니다. 또한 피벗 키를 클릭하면 이벤트를 처리하는 방법. 감사합니다. .콘텐츠 대화 상자에 PasswordBox가있는 Windows IoT UWP 피벗 항목
XAML;
Title="Login"
PrimaryButtonText="OK"
SecondaryButtonText="Cancel"
PrimaryButtonClick="ContentDialog_PrimaryButtonClick"
SecondaryButtonClick="ContentDialog_SecondaryButtonClick">
<Grid>
<StackPanel>
<PasswordBox x:Name="passwordBox" Width="300" Height="30" PlaceholderText="Enter password" PasswordChar="*"
PasswordChanged="PasswordBox_PasswordChanged"/>
<TextBlock x:Name="statusText" Margin="3,10,2,10" Height="22"/>
</StackPanel>
</Grid>
업데이트 -이 최선의 비밀번호를 확인했다 경우 24-11-2017 나는 확실하지 않다. content dialog
이 닫힌 후에도 알고 싶습니다. XAML 코드를 어디에서 더 확장해야합니까? 희망 사항을 여기에 명확하게 표현하고 싶습니다. 감사.
<PivotItem Header="Settings" x:Name="settings" PointerPressed="settings_PointerPressed" >
<ContentDialog Title="Login" x:Name="loginDialog"
PrimaryButtonText="OK"
SecondaryButtonText="Cancel"
PrimaryButtonClick="OK_PrimaryButtonClick"
SecondaryButtonClick="Cancel_SecondaryButtonClick">
<Grid>
<StackPanel>
<PasswordBox x:Name="passwordBox" Width="300" Height="40" PlaceholderText="Enter PIN" PasswordChar="*"
PasswordChanged="passwordBox_PasswordChanged" IsPasswordRevealButtonEnabled="False">
<PasswordBox.InputScope>
<InputScope>
<InputScope.Names>
<InputScopeName NameValue="NumericPin"/>
</InputScope.Names>
</InputScope>
</PasswordBox.InputScope>
</PasswordBox>
<TextBlock x:Name="passwordStatus" Margin="3,10,2,10" Height="22"/>
</StackPanel>
</Grid>
</ContentDialog>
</PivotItem>
private async void settings_PointerPressed(object sender, PointerRoutedEventArgs e)
{
if(isPasswordGranted==false)
{
await loginDialog.ShowAsync();
//PasswordBox passwordBox = new PasswordBox();
//passwordBox.Header = "Enter password";
InputScope scope = new InputScope();
InputScopeName scopeName = new InputScopeName();
scopeName.NameValue = InputScopeNameValue.NumericPin; //default = Password
scope.Names.Add(scopeName);
passwordBox.InputScope = scope;
}
}
private void OK_PrimaryButtonClick(ContentDialog sender, ContentDialogButtonClickEventArgs args)
{
if (passwordBox.Password == pinNumber)
{
passwordStatus.Text = "Password Granted!";
isPasswordGranted = true;
}
else pivot.SelectedItem = home;
}
private void Cancel_SecondaryButtonClick(ContentDialog sender, ContentDialogButtonClickEventArgs args)
{
pivot.SelectedItem = home;
}
감사합니다. passwordbox에 가상 키보드를 활성화하는 방법이 있습니까? 암호를 수락하면 pivotitem을 클릭해도 암호 대화 상자가 다시 나타나지 않습니다. 어떻게해야합니까? – mylim
** Device Portal **을 사용하여 가상 키보드를 활성화 할 수 있습니다 (장치 설정 -> 온 스크린 키보드, 확인란 선택). 변수 을 플래그로 설정하여 암호 대화 상자를 표시해야하는시기를 나타낼 수 있습니다. –
감사합니다. 암호'content dialog'에 대한 추가 질문이 있습니다. 암호'content dialog'가'pivotitem'에 있기 때문에,'content dialog'가 닫힌 후에 같은 pivotitem에서 어떻게 코드를 확장합니까? – mylim