You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
146 lines
6.2 KiB
146 lines
6.2 KiB
<!--*************************************************************************************
|
|
|
|
Toolkit for WPF
|
|
|
|
Copyright (C) 2007-2025 Xceed Software Inc.
|
|
|
|
This program is provided to you under the terms of the XCEED SOFTWARE, INC.
|
|
COMMUNITY LICENSE AGREEMENT (for non-commercial use) as published at
|
|
https://github.com/xceedsoftware/wpftoolkit/blob/master/license.md
|
|
|
|
For more features, controls, and fast professional support,
|
|
pick up the Plus Edition at https://xceed.com/xceed-toolkit-plus-for-wpf/
|
|
|
|
Stay informed: follow @datagrid on Twitter or Like http://facebook.com/datagrids
|
|
|
|
***********************************************************************************-->
|
|
<local:DemoView x:Class="Xceed.Wpf.Toolkit.LiveExplorer.Samples.Text.Views.WatermarkPasswordBoxView"
|
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
|
xmlns:local="clr-namespace:Xceed.Wpf.Toolkit.LiveExplorer"
|
|
xmlns:xctk="http://schemas.xceed.com/wpf/xaml/toolkit"
|
|
xmlns:sys="clr-namespace:System;assembly=mscorlib"
|
|
Title="WatermarkPasswordBox">
|
|
<local:DemoView.Description>
|
|
<Paragraph FontSize="14"
|
|
FontFamily="Segoe">
|
|
The WatermarkPasswordBox is a PasswordBox where you can enter a secure password and display a watermark when the password is not defined.
|
|
</Paragraph>
|
|
</local:DemoView.Description>
|
|
|
|
<local:DemoView.Resources>
|
|
<DataTemplate x:Key="WatermarkTemplate1">
|
|
<Grid>
|
|
<TextBlock Text="{Binding}"
|
|
Foreground="Blue"
|
|
Background="Orange"
|
|
FontSize="12"
|
|
HorizontalAlignment="Center"
|
|
VerticalAlignment="Center" />
|
|
</Grid>
|
|
</DataTemplate>
|
|
|
|
<DataTemplate x:Key="WatermarkTemplate2">
|
|
<Border BorderBrush="Red"
|
|
BorderThickness="1">
|
|
<ContentControl Content="{Binding}"
|
|
Foreground="DarkRed"
|
|
FontWeight="Bold"
|
|
Focusable="False"
|
|
Margin="4,0,4,0"/>
|
|
</Border>
|
|
</DataTemplate>
|
|
</local:DemoView.Resources>
|
|
|
|
<StackPanel>
|
|
<GroupBox Header="Features">
|
|
<Grid Margin="5">
|
|
<Grid.RowDefinitions>
|
|
<RowDefinition Height="Auto"/>
|
|
<RowDefinition Height="Auto"/>
|
|
</Grid.RowDefinitions>
|
|
<Grid.ColumnDefinitions>
|
|
<ColumnDefinition Width="Auto" />
|
|
<ColumnDefinition Width="Auto" />
|
|
<ColumnDefinition Width="Auto" />
|
|
<ColumnDefinition Width="Auto" />
|
|
</Grid.ColumnDefinitions>
|
|
|
|
<!--1st Column-->
|
|
<TextBlock Text="PasswordChar: "
|
|
VerticalAlignment="Center" />
|
|
<TextBox Grid.Column="1"
|
|
MaxLength="1"
|
|
Text="{Binding PasswordChar, ElementName=_watermarkPasswordBox}"
|
|
Width="18"
|
|
Margin="5,5,25,5"
|
|
HorizontalAlignment="Left"
|
|
VerticalAlignment="Center" />
|
|
|
|
<TextBlock Grid.Row="1"
|
|
Text="Password: "
|
|
VerticalAlignment="Center" />
|
|
<TextBlock Grid.Row="1"
|
|
Grid.Column="1"
|
|
x:Name="_passwordTextBlock"
|
|
Width="190"
|
|
Margin="5,5,25,5"
|
|
HorizontalAlignment="Left"
|
|
VerticalAlignment="Center" />
|
|
|
|
<!--2nd column-->
|
|
<TextBlock Grid.Column="2"
|
|
Text="Watermark: "
|
|
Margin="5"
|
|
VerticalAlignment="Center" />
|
|
<TextBox Grid.Column="3"
|
|
Text="{Binding Watermark, ElementName=_watermarkPasswordBox}"
|
|
Width="190"
|
|
Margin="5,5,25,5"
|
|
HorizontalAlignment="Left"
|
|
VerticalAlignment="Center" />
|
|
|
|
<TextBlock Grid.Row="1"
|
|
Grid.Column="2"
|
|
Text="Watermark Template: "
|
|
Margin="5"
|
|
VerticalAlignment="Center" />
|
|
<ComboBox Grid.Row="1"
|
|
Grid.Column="3"
|
|
Width="100"
|
|
Margin="5,5,25,5"
|
|
SelectedValue="{Binding WatermarkTemplate, ElementName=_watermarkPasswordBox}"
|
|
SelectedValuePath="Tag"
|
|
HorizontalAlignment="Left"
|
|
VerticalAlignment="Center">
|
|
<ComboBoxItem Content="Default"
|
|
Tag="{x:Null}" />
|
|
<ComboBoxItem Content="Template 1"
|
|
Tag="{StaticResource WatermarkTemplate1}" />
|
|
<ComboBoxItem Content="Template 2"
|
|
Tag="{StaticResource WatermarkTemplate2}" />
|
|
</ComboBox>
|
|
</Grid>
|
|
</GroupBox>
|
|
|
|
<StackPanel>
|
|
<TextBlock Text="Usage:"
|
|
Style="{StaticResource Header}" />
|
|
|
|
<StackPanel Margin="10">
|
|
<TextBlock Text="Default:"
|
|
Style="{StaticResource Header}" />
|
|
<xctk:WatermarkPasswordBox x:Name="_watermarkPasswordBox"
|
|
Margin="5"
|
|
MinWidth="200"
|
|
Watermark="Enter Password here..."
|
|
WatermarkTemplate="{x:Null}"
|
|
PasswordChar='●'
|
|
MaxLength="10"
|
|
KeepWatermarkOnGotFocus="True"
|
|
PasswordChanged="WatermarkPasswordBox_PasswordChanged" />
|
|
</StackPanel>
|
|
</StackPanel>
|
|
</StackPanel>
|
|
|
|
</local:DemoView>
|
|
|