We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

SfTextInputLayout support for custom control

Is there a way to customize the support for custom control (BindablePasswordBox) that I have created?

Here is the code for the usercontrol:

using System.Windows;

using System.Windows.Controls;

using System.Windows.Data;


namespace PasswordBoxMVVM.Components

{

    public partial class BindablePasswordBox : UserControl

    {

        private bool _isPasswordChanging;


        public static readonly DependencyProperty PasswordProperty =

            DependencyProperty.Register("Password", typeof(string), typeof(BindablePasswordBox),

                new FrameworkPropertyMetadata(string.Empty, FrameworkPropertyMetadataOptions.BindsTwoWayByDefault,

                    PasswordPropertyChanged, null, false, UpdateSourceTrigger.PropertyChanged));


        private static void PasswordPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)

        {

            if(d is BindablePasswordBox passwordBox)

            {

                passwordBox.UpdatePassword();

            }

        }


        public string Password

        {

            get { return (string)GetValue(PasswordProperty); }

            set { SetValue(PasswordProperty, value); }

        }


        public BindablePasswordBox()

        {

            InitializeComponent();

        }


        private void PasswordBox_PasswordChanged(object sender, RoutedEventArgs e)

        {

            _isPasswordChanging = true;

            Password = passwordBox.Password;

            _isPasswordChanging = false;

        }


        private void UpdatePassword()

        {

            if(!_isPasswordChanging)

            {

                passwordBox.Password = Password;

            }

        }

    }

}

and xaml:



1 Reply

ET Eswaran Thirugnanasambandam Syncfusion Team January 3, 2023 01:28 PM UTC

Hi Mariusz Juszkiewicz,


Currently, SfTextInputLayout controls doesn’t support custom control as input view, and it supports only following inputviews such as TextBox, PasswordBox, ComboBox, ComboBoxAdv, and SfTextBoxExt. Please refer the below link to know more about supported input views in SfTextInputLayout controls.

https://help.syncfusion.com/wpf/textinputlayout/supported-input-views


Regards,

Eswaran


Loader.
Up arrow icon