mirror of
https://github.com/wismna/ModernKeePass.git
synced 2025-10-03 15:40:18 -04:00
WIP Windows 10
Dependencies finally installed Removal of useless code Big cleanup in XAML styles (override colors the correct way)
This commit is contained in:
86
WinAppCommon/Controls/PasswordBoxWithButton.cs
Normal file
86
WinAppCommon/Controls/PasswordBoxWithButton.cs
Normal file
@@ -0,0 +1,86 @@
|
||||
using System;
|
||||
using Windows.UI.Xaml;
|
||||
using Windows.UI.Xaml.Controls;
|
||||
|
||||
namespace ModernKeePass.Controls
|
||||
{
|
||||
public class PasswordBoxWithButton: SearchBox
|
||||
{
|
||||
public event EventHandler<RoutedEventArgs> ButtonClick;
|
||||
|
||||
public string ButtonSymbol
|
||||
{
|
||||
get { return (string)GetValue(ButtonSymbolProperty); }
|
||||
set { SetValue(ButtonSymbolProperty, value); }
|
||||
}
|
||||
public static readonly DependencyProperty ButtonSymbolProperty =
|
||||
DependencyProperty.Register(
|
||||
nameof(ButtonSymbol),
|
||||
typeof(string),
|
||||
typeof(PasswordBoxWithButton),
|
||||
new PropertyMetadata("", (o, args) => { }));
|
||||
|
||||
public string ButtonTooltip
|
||||
{
|
||||
get { return (string)GetValue(ButtonTooltipProperty); }
|
||||
set { SetValue(ButtonTooltipProperty, value); }
|
||||
}
|
||||
public static readonly DependencyProperty ButtonTooltipProperty =
|
||||
DependencyProperty.Register(
|
||||
nameof(ButtonTooltip),
|
||||
typeof(string),
|
||||
typeof(PasswordBoxWithButton),
|
||||
new PropertyMetadata(string.Empty, (o, args) => { }));
|
||||
|
||||
public string Password
|
||||
{
|
||||
get { return (string)GetValue(PasswordProperty); }
|
||||
set { SetValue(PasswordProperty, value); }
|
||||
}
|
||||
public static readonly DependencyProperty PasswordProperty =
|
||||
DependencyProperty.Register(
|
||||
nameof(Password),
|
||||
typeof(string),
|
||||
typeof(PasswordBoxWithButton),
|
||||
new PropertyMetadata(string.Empty, (o, args) => { }));
|
||||
|
||||
public bool IsButtonEnabled
|
||||
{
|
||||
get { return (bool)GetValue(IsButtonEnabledProperty); }
|
||||
set { SetValue(IsButtonEnabledProperty, value); }
|
||||
}
|
||||
public static readonly DependencyProperty IsButtonEnabledProperty =
|
||||
DependencyProperty.Register(
|
||||
nameof(IsButtonEnabled),
|
||||
typeof(bool),
|
||||
typeof(PasswordBoxWithButton),
|
||||
new PropertyMetadata(true, (o, args) => { }));
|
||||
|
||||
public bool IsPasswordRevealEnabled
|
||||
{
|
||||
get { return (bool)GetValue(IsPasswordRevealEnabledProperty); }
|
||||
set { SetValue(IsPasswordRevealEnabledProperty, value); }
|
||||
}
|
||||
public static readonly DependencyProperty IsPasswordRevealEnabledProperty =
|
||||
DependencyProperty.Register(
|
||||
nameof(IsPasswordRevealEnabled),
|
||||
typeof(bool),
|
||||
typeof(PasswordBoxWithButton),
|
||||
new PropertyMetadata(true, (o, args) => { }));
|
||||
|
||||
|
||||
public PasswordBoxWithButton()
|
||||
{
|
||||
DefaultStyleKey = typeof(PasswordBoxWithButton);
|
||||
}
|
||||
protected override void OnApplyTemplate()
|
||||
{
|
||||
base.OnApplyTemplate();
|
||||
var actionButton = GetTemplateChild("ActionButton") as Button;
|
||||
if (actionButton != null)
|
||||
{
|
||||
actionButton.Click += (sender, e) => ButtonClick?.Invoke(sender, e);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@@ -5,7 +5,7 @@ using Windows.UI.Xaml.Controls;
|
||||
|
||||
namespace ModernKeePass.Controls
|
||||
{
|
||||
public class TextBoxWithButton : Control
|
||||
public class TextBoxWithButton : SearchBox
|
||||
{
|
||||
public event EventHandler<RoutedEventArgs> ButtonClick;
|
||||
|
||||
@@ -44,17 +44,6 @@ namespace ModernKeePass.Controls
|
||||
typeof(string),
|
||||
typeof(TextBoxWithButton),
|
||||
new PropertyMetadata(string.Empty, (o, args) => { }));
|
||||
public string PlaceholderText
|
||||
{
|
||||
get { return (string)GetValue(PlaceholderTextProperty); }
|
||||
set { SetValue(PlaceholderTextProperty, value); }
|
||||
}
|
||||
public static readonly DependencyProperty PlaceholderTextProperty =
|
||||
DependencyProperty.Register(
|
||||
nameof(PlaceholderText),
|
||||
typeof(string),
|
||||
typeof(TextBoxWithButton),
|
||||
new PropertyMetadata(string.Empty, (o, args) => { }));
|
||||
|
||||
public ICommand ButtonCommand
|
||||
{
|
||||
@@ -75,7 +64,7 @@ namespace ModernKeePass.Controls
|
||||
}
|
||||
public static readonly DependencyProperty IsButtonEnabledProperty =
|
||||
DependencyProperty.Register(
|
||||
"IsButtonEnabled",
|
||||
nameof(IsButtonEnabled),
|
||||
typeof(bool),
|
||||
typeof(TextBoxWithButton),
|
||||
new PropertyMetadata(true, (o, args) => { }));
|
||||
|
@@ -17,6 +17,7 @@
|
||||
<Compile Include="$(MSBuildThisFileDirectory)Common\NavigationHelper.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)Common\SuspensionManager.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)Controls\ListViewWithDisable.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)Controls\PasswordBoxWithButton.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)Controls\TextBoxWithButton.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)Converters\BooleanToVisibilityConverter.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)Converters\ColorToBrushConverter.cs" />
|
||||
|
Reference in New Issue
Block a user