mirror of
https://github.com/Tyrrrz/DiscordChatExporter.git
synced 2025-05-30 14:35:18 -04:00
Make password box un-editable
This commit is contained in:
parent
81a6d363d1
commit
0ee1107638
2 changed files with 4 additions and 17 deletions
|
@ -12,13 +12,13 @@
|
||||||
<TextBox
|
<TextBox
|
||||||
materialDesign:TextFieldAssist.DecorationVisibility="Hidden"
|
materialDesign:TextFieldAssist.DecorationVisibility="Hidden"
|
||||||
BorderThickness="{Binding BorderThickness, ElementName=Root}"
|
BorderThickness="{Binding BorderThickness, ElementName=Root}"
|
||||||
Text="{Binding Password, ElementName=Root}"
|
Text="{Binding Password, ElementName=Root, UpdateSourceTrigger=PropertyChanged}"
|
||||||
Visibility="{Binding IsRevealed, ElementName=Root, Converter={x:Static s:BoolToVisibilityConverter.Instance}}" />
|
Visibility="{Binding IsRevealed, ElementName=Root, Converter={x:Static s:BoolToVisibilityConverter.Instance}}" />
|
||||||
<PasswordBox
|
<PasswordBox
|
||||||
x:Name="PasswordBox"
|
materialDesign:PasswordBoxAssist.Password="{Binding Password, ElementName=Root, UpdateSourceTrigger=PropertyChanged}"
|
||||||
materialDesign:TextFieldAssist.DecorationVisibility="Hidden"
|
materialDesign:TextFieldAssist.DecorationVisibility="Hidden"
|
||||||
BorderThickness="{Binding BorderThickness, ElementName=Root}"
|
BorderThickness="{Binding BorderThickness, ElementName=Root}"
|
||||||
PasswordChanged="PasswordBox_OnPasswordChanged"
|
IsEnabled="False"
|
||||||
Visibility="{Binding IsRevealed, ElementName=Root, Converter={x:Static s:BoolToVisibilityConverter.InverseInstance}}" />
|
Visibility="{Binding IsRevealed, ElementName=Root, Converter={x:Static s:BoolToVisibilityConverter.InverseInstance}}" />
|
||||||
</Grid>
|
</Grid>
|
||||||
</UserControl>
|
</UserControl>
|
|
@ -8,17 +8,7 @@ public partial class RevealablePasswordBox
|
||||||
nameof(Password),
|
nameof(Password),
|
||||||
typeof(string),
|
typeof(string),
|
||||||
typeof(RevealablePasswordBox),
|
typeof(RevealablePasswordBox),
|
||||||
new FrameworkPropertyMetadata(
|
new FrameworkPropertyMetadata(string.Empty, FrameworkPropertyMetadataOptions.BindsTwoWayByDefault)
|
||||||
string.Empty,
|
|
||||||
FrameworkPropertyMetadataOptions.BindsTwoWayByDefault,
|
|
||||||
(sender, args) =>
|
|
||||||
{
|
|
||||||
var revealablePasswordBox = (RevealablePasswordBox)sender;
|
|
||||||
var password = (string)args.NewValue;
|
|
||||||
|
|
||||||
revealablePasswordBox.PasswordBox.Password = password;
|
|
||||||
}
|
|
||||||
)
|
|
||||||
);
|
);
|
||||||
|
|
||||||
public static readonly DependencyProperty IsRevealedProperty = DependencyProperty.Register(
|
public static readonly DependencyProperty IsRevealedProperty = DependencyProperty.Register(
|
||||||
|
@ -44,7 +34,4 @@ public partial class RevealablePasswordBox
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void PasswordBox_OnPasswordChanged(object sender, RoutedEventArgs args) =>
|
|
||||||
Password = PasswordBox.Password;
|
|
||||||
}
|
}
|
Loading…
Add table
Add a link
Reference in a new issue