--- title: Getting Started page_title: Getting Started description: Check our "Getting Started" documentation article for the RadPasswordBox {{ site.framework_name }} control. slug: radpasswordbox-getting-started tags: getting,started published: True position: 1 --- # Getting Started with {{ site.framework_name }} PasswordBox This tutorial will walk you through the creation of a sample application that contains __RadPasswordBox__. * [Adding Telerik Assemblies Using NuGet](#adding-telerik-assemblies-using-nuget) * [Adding Assembly References Manually](#adding-assembly-references-manually) * [Adding RadPasswordBox to the Project](#adding-radpasswordbox-to-the-project) * [Setting Watermark](#setting-watermark) ## Adding Telerik Assemblies Using NuGet To use __RadPasswordBox__ when working with NuGet packages, install the `Telerik.Windows.Controls.for.Wpf.Xaml` package. The [package name may vary]({%slug nuget-available-packages%}) slightly based on the Telerik dlls set - [Xaml or NoXaml]({%slug xaml-vs-noxaml%}) Read more about NuGet installation in the [Installing UI for WPF from NuGet Package]({%slug nuget-installation%}) article. >tip With the 2025 Q1 release, the Telerik UI for WPF has a new licensing mechanism. You can learn more about it [here]({%slug installing-license-key%}). ## Adding Assembly References Manually If you are not using NuGet packages, you can add a reference to the following assemblies: * __Telerik.Licensing.Runtime__ * __Telerik.Windows.Controls__ ## Adding RadPasswordBox to the Project Before proceeding with adding __RadPasswordBox__ to your project, make sure the required assembly references are added to the project. You can add __RadPasswordBox__ manually by writing the XAML code in __Example 1__. You can also add the control by dragging it from the Visual Studio Toolbox and dropping it over the XAML view. #### __[XAML] Example 1: Adding RadPasswordBox in XAML__ {{region passwordbox-getting-started_0}} {{endregion}} >In order to use __RadPasswordBox__ in XAML you have to add the namespace declaration shown in __Example 2__: >#### __[XAML] Example 2: Declaring Telerik Namespace__ >{{region telerik-schemas}} > xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation" >{{endregion}} If you run the application you will see the PasswordBox as illustrated in __Figure 1__. #### __Figure 1: RadPasswordBox generated by the code in Example 1__ ![{{ site.framework_name }} RadPasswordBox RadPasswordBox generated by the code in Example 1](images/RadPasswordBox_GettingStarted_0.png) ## Setting Watermark When RadPasswordBox is empty and not focused, Watermark content can be shown. __Example 2__ demonstrates how to set Watermark text. #### __[XAML] Example 2: Setting a watermark__ {{region passwordbox-getting-started_1}} {{endregion}} __Figure 2__ shows the result. #### __Figure 2: RadPasswordBoxBox with Watermark set__ ![{{ site.framework_name }} RadPasswordBox RadPasswordBoxBox with Watermark set](images/RadPasswordBox_GettingStarted_1.png) ## Working with RadPasswordBox The Text property of the RadPasswordBox contains only the sequence of masking characters set by the PasswordChar property. The actual input can be reached through the Password and SecurePassword properties. These properties are not dependency properties (cannot be bound) due to security reasons. To get these properties in MVVM, you can pass the RadPasswordBox element to a command from your view model. Let's demonstrate this with some code. First we will declare the RadPasswordBox in XAML and bind a RadButton's Command property to a command from our view model. #### __[XAML] Example 3: Declare the RadPasswordBox in XAML__ {{region passwordbox-getting-started_2}} {{endregion}} Now we just need to create our view model. #### __[C#] Example 3: Create ViewModel__ {{region passwordbox-getting-started_2}} public class ViewModel { public System.Windows.Input.ICommand LoginCommand { get; set; } public ViewModel() { LoginCommand = new DelegateCommand(OnLoginCommand_Executed); } private void OnLoginCommand_Executed(object obj) { var passwordBox = obj as RadPasswordBox; if(passwordBox != null) { // actual entered password var password = passwordBox.Password; } } } {{endregion}} VoilĂ ! Now when you click on the Login button, the __LoginCommand.Execute()__ method will be called. Inside the method you can get the __RadPasswordBox__ from the parameter and see the entered password from the __Password__ property. ## Setting a Theme The controls from our suite support different themes. You can see how to apply a theme different than the default one in the [Setting a Theme]({%slug styling-apperance-implicit-styles-overview%}) help article. >important Changing the theme using implicit styles will affect all controls that have styles defined in the merged resource dictionaries. This is applicable only for the controls in the scope in which the resources are merged. To change the theme, you can follow the steps below: * Choose between the themes and add reference to the corresponding theme assembly (ex: **Telerik.Windows.Themes.Windows8.dll**). You can see the different themes applied in the **Theming** examples from our {% if site.site_name == 'WPF' %}[WPF Controls Examples](https://demos.telerik.com/wpf/){% else %}[Silverlight Controls Examples](https://demos.telerik.com/silverlight/#PanelBar/Theming){% endif %} application. * Merge the ResourceDictionaries with the namespace required for the controls that you are using from the theme assembly. For the RadPasswordBox, you will need to merge the following resources: * __Telerik.Windows.Controls__ * __Telerik.Windows.Controls.Navigation__ __Example 4__ demonstrates how to merge the ResourceDictionaries so that they are applied globally for the entire application. #### __[XAML] Example 4: Merge the ResourceDictionaries__ {{region radpasswordbox-getting-started_4}} {{endregion}} >Alternatively, you can use the theme of the control via the {% if site.site_name == 'WPF' %}[StyleManager](https://docs.telerik.com/devtools/wpf/styling-and-appearance/stylemanager/common-styling-apperance-setting-theme-wpf){% else %}[StyleManager](https://docs.telerik.com/devtools/silverlight/styling-and-appearance/stylemanager/common-styling-apperance-setting-theme){% endif %}. __Figure 2__ shows a RadPasswordBox with the **Windows8** theme applied. #### __Figure 2: RadPasswordBox with the Windows8 theme__ ![RadPasswordBox with Windows8 theme](images/radpasswordbox-setting-theme.png) {% if site.site_name == 'WPF' %} ## Telerik UI for WPF Learning Resources * [Telerik UI for WPF PasswordBox Component](https://www.telerik.com/products/wpf/passwordbox.aspx) * [Getting Started with Telerik UI for WPF Components]({%slug getting-started-first-steps%}) * [Telerik UI for WPF Installation]({%slug installation-installing-which-file-do-i-need%}) * [Telerik UI for WPF and WinForms Integration]({%slug winforms-integration%}) * [Telerik UI for WPF Visual Studio Templates]({%slug visual-studio-templates%}) * [Setting a Theme with Telerik UI for WPF]({%slug styling-apperance-implicit-styles-overview%}) * [Telerik UI for WPF Virtual Classroom (Training Courses for Registered Users)](https://learn.telerik.com/learn/course/external/view/elearning/16/telerik-ui-for-wpf) * [Telerik UI for WPF License Agreement](https://www.telerik.com/purchase/license-agreement/wpf-dlw-s) {% endif %} ## See Also * [Overview]({%slug radpasswordbox-overview%}) * [Visual Structure]({%slug radpasswordbox-visual-structure%})