mirror of
https://github.com/wismna/ModernKeePass.git
synced 2025-10-03 15:40:18 -04:00

New tooltip in Textbox with button control New welcome page in Settings (shown when noting is selected) Settings are now grouped
44 lines
1.5 KiB
C#
44 lines
1.5 KiB
C#
using System;
|
|
using Windows.UI.Xaml;
|
|
using Windows.UI.Xaml.Controls;
|
|
|
|
namespace ModernKeePass.Controls
|
|
{
|
|
public class TextBoxWithButton : TextBox
|
|
{
|
|
public string ButtonSymbol
|
|
{
|
|
get { return (string)GetValue(ButtonSymbolProperty); }
|
|
set { SetValue(ButtonSymbolProperty, value); }
|
|
}
|
|
public static readonly DependencyProperty ButtonSymbolProperty =
|
|
DependencyProperty.Register(
|
|
"ButtonSymbol",
|
|
typeof(string),
|
|
typeof(TextBoxWithButton),
|
|
new PropertyMetadata("", (o, args) => { }));
|
|
public event EventHandler<RoutedEventArgs> ButtonClick;
|
|
|
|
public string ButtonTooltip
|
|
{
|
|
get { return (string)GetValue(ButtonTooltipProperty); }
|
|
set { SetValue(ButtonTooltipProperty, value); }
|
|
}
|
|
public static readonly DependencyProperty ButtonTooltipProperty =
|
|
DependencyProperty.Register(
|
|
"ButtonTooltip",
|
|
typeof(string),
|
|
typeof(TextBoxWithButton),
|
|
new PropertyMetadata(string.Empty, (o, args) => { }));
|
|
|
|
protected override void OnApplyTemplate()
|
|
{
|
|
base.OnApplyTemplate();
|
|
var actionButton = GetTemplateChild("ActionButton") as Button;
|
|
if (actionButton != null)
|
|
{
|
|
actionButton.Click += (sender, e) => ButtonClick?.Invoke(sender, e);
|
|
}
|
|
}
|
|
}
|
|
} |