PasswordBoxを使用する WPFPasswordBoxを使用する WPFパスワードボックスは、入力テキストの表示を、任意の1文字に置き換えてくれるテキストボックスだ。 Windowsのフォームコントロールを使用する方法は、XAMLに、フォームコントロールの名前空間を宣言する必要があります。 名前空間とは?先ほど出てきた、名前空間ですが、xmlnsがお決まり。 ![]()
<Window x:Class="Window6"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="Window6" Height="415" Width="307" WindowStyle="SingleBorderWindow"
xmlns:wf="clr-namespace:System.Windows.Forms;assembly=System.Windows.Forms">
<Grid>
<StackPanel >
<PasswordBox Height="51" Name="PasswordBox1" Width="120" PasswordChar="e" BorderBrush="#FF784B00" Background="Red" BorderThickness="10" />
<PasswordBox Height="24" Name="PasswordBox2" Width="120" />
<Rectangle Height="71" Name="Rectangle1" Stroke="#FF7EC300" Width="152" Fill="#FF8C0000" />
<Rectangle Height="67" Name="Rectangle2" Stroke="Black" Width="159" />
<WindowsFormsHost Height="26" Name="WindowsFormsHost1" Width="152" >
<wf:TextBox Name="TextBox1_F" ImeMode="Alpha">
</wf:TextBox>
</WindowsFormsHost>
</StackPanel>
</Grid>
</Window>
|