Not able to bind UserControl from main View
I have created user control which contain TextBox and PasswordBox.
**RestrictedBox.xaml**

    <UserControl.Resources>
            <Converters:BoolToVisibilityConverter x:Key="boolToVisConverter" />
            <Converters:BoolToVisibilityConverter x:Key="boolToVisConverterReverse" />
        </UserControl.Resources>
        <Grid x:Name="LayoutRoot" Background="White" Width="Auto">
            <StackPanel Margin="5,5,5,5">
                <TextBox Text="{Binding TextValue}" Visibility="{Binding IsTextBox,Converter={StaticResource boolToVisConverter}}" BorderBrush="Green" />
                <PasswordBox Password="{Binding TextValue}" Visibility="{Binding IsTextBox,Converter={StaticResource boolToVisConverterReverse}}" BorderBrush="Red" />
            </StackPanel>
        </Grid>

**RestrictedBox.xaml.cs**

    public partial class RestrictedBox : UserControl
        {
            public RestrictedBox()
            {
                InitializeComponent();
            }
    
            public string TextValue
            {
                get { return (string)GetValue(TextValueProperty); }
                set { SetValue(TextValueProperty, value); }
            }
            public static readonly DependencyProperty TextValueProperty = DependencyProperty.Register("TextValue", typeof(string), typeof(RestrictedBox), new PropertyMetadata(default(string)));
    
            public bool IsTextBox
            {
                get { return (bool)GetValue(IsTextBoxProperty); }
                set { SetValue(IsTextBoxProperty, value); }
            }
            public static readonly DependencyProperty IsTextBoxProperty = DependencyProperty.Register("IsTextBox", typeof(bool), typeof(RestrictedBox), new PropertyMetadata(default(bool)));
        }

Now i added above User Control to my **LoginView.xaml** page

    <control:RestrictedBox TextValue="Imdadhusen" IsTextBox="True"   />

**Now i run the application but the TextValue = "Imdadhusen" is not bind with my text box and the second property IsTextBox is set to True that means it will automatically hide Passwordbox else Textbox.**

Any help would be appreciated!

Thanks,
Imdadhusen
Not able to bind UserControl from main View
===

I have created user control which contain TextBox and PasswordBox.
**RestrictedBox.xaml**

    <UserControl.Resources>
            <Converters:BoolToVisibilityConverter x:Key="boolToVisConverter" />
            <Converters:BoolToVisibilityConverter x:Key="boolToVisConverterReverse" />
        </UserControl.Resources>
        <Grid x:Name="LayoutRoot" Background="White" Width="Auto">
            <StackPanel Margin="5,5,5,5">
                <TextBox Text="{Binding TextValue}" Visibility="{Binding IsTextBox,Converter={StaticResource boolToVisConverter}}" BorderBrush="Green" />
                <PasswordBox Password="{Binding TextValue}" Visibility="{Binding IsTextBox,Converter={StaticResource boolToVisConverterReverse}}" BorderBrush="Red" />
            </StackPanel>
        </Grid>

**RestrictedBox.xaml.cs**

    public partial class RestrictedBox : UserControl
        {
            public RestrictedBox()
            {
                InitializeComponent();
            }
    
            public string TextValue
            {
                get { return (string)GetValue(TextValueProperty); }
                set { SetValue(TextValueProperty, value); }
            }
            public static readonly DependencyProperty TextValueProperty = DependencyProperty.Register("TextValue", typeof(string), typeof(RestrictedBox), new PropertyMetadata(default(string)));
    
            public bool IsTextBox
            {
                get { return (bool)GetValue(IsTextBoxProperty); }
                set { SetValue(IsTextBoxProperty, value); }
            }
            public static readonly DependencyProperty IsTextBoxProperty = DependencyProperty.Register("IsTextBox", typeof(bool), typeof(RestrictedBox), new PropertyMetadata(default(bool)));
        }

Now i added above User Control to my **LoginView.xaml** page

    <control:RestrictedBox TextValue="Imdadhusen" IsTextBox="True"   />

**Now i run the application but the TextValue = "Imdadhusen" is not bind with my text box and the second property IsTextBox is set to True that means it will automatically hide Passwordbox else Textbox.**

Any help would be appreciated!

Thanks,
Imdadhusen