Browse Source

rename prop

pull/4487/head
Jumar Macato 6 years ago
parent
commit
8300b0c35d
No known key found for this signature in database GPG Key ID: B19884DAC3A5BF3F
  1. 16
      src/Avalonia.Controls/Presenters/TextPresenter.cs
  2. 10
      src/Avalonia.Controls/TextBox.cs
  3. 8
      src/Avalonia.Themes.Fluent/TextBox.xaml

16
src/Avalonia.Controls/Presenters/TextPresenter.cs

@ -14,8 +14,8 @@ namespace Avalonia.Controls.Presenters
o => o.CaretIndex,
(o, v) => o.CaretIndex = v);
public static readonly StyledProperty<bool> RevealPasswordTextProperty =
AvaloniaProperty.Register<TextPresenter, bool>(nameof(RevealPasswordText));
public static readonly StyledProperty<bool> RevealPasswordProperty =
AvaloniaProperty.Register<TextPresenter, bool>(nameof(RevealPassword));
public static readonly StyledProperty<char> PasswordCharProperty =
AvaloniaProperty.Register<TextPresenter, char>(nameof(PasswordChar));
@ -78,7 +78,7 @@ namespace Avalonia.Controls.Presenters
static TextPresenter()
{
AffectsRender<TextPresenter>(SelectionBrushProperty);
AffectsMeasure<TextPresenter>(TextProperty, PasswordCharProperty, RevealPasswordTextProperty,
AffectsMeasure<TextPresenter>(TextProperty, PasswordCharProperty, RevealPasswordProperty,
TextAlignmentProperty, TextWrappingProperty, TextBlock.FontSizeProperty,
TextBlock.FontStyleProperty, TextBlock.FontWeightProperty, TextBlock.FontFamilyProperty);
@ -87,7 +87,7 @@ namespace Avalonia.Controls.Presenters
TextBlock.FontSizeProperty.Changed, TextBlock.FontStyleProperty.Changed,
TextBlock.FontWeightProperty.Changed, TextBlock.FontFamilyProperty.Changed,
SelectionStartProperty.Changed, SelectionEndProperty.Changed,
SelectionForegroundBrushProperty.Changed, PasswordCharProperty.Changed, RevealPasswordTextProperty.Changed
SelectionForegroundBrushProperty.Changed, PasswordCharProperty.Changed, RevealPasswordProperty.Changed
).AddClassHandler<TextPresenter>((x, _) => x.InvalidateFormattedText());
CaretIndexProperty.Changed.AddClassHandler<TextPresenter>((x, e) => x.CaretIndexChanged((int)e.NewValue));
@ -213,10 +213,10 @@ namespace Avalonia.Controls.Presenters
set => SetValue(PasswordCharProperty, value);
}
public bool RevealPasswordText
public bool RevealPassword
{
get => GetValue(RevealPasswordTextProperty);
set => SetValue(RevealPasswordTextProperty, value);
get => GetValue(RevealPasswordProperty);
set => SetValue(RevealPasswordProperty, value);
}
public IBrush SelectionBrush
@ -435,7 +435,7 @@ namespace Avalonia.Controls.Presenters
var text = Text;
if (PasswordChar != default(char) && !RevealPasswordText)
if (PasswordChar != default(char) && !RevealPassword)
{
result = CreateFormattedTextInternal(_constraint, new string(PasswordChar, text?.Length ?? 0));
}

10
src/Avalonia.Controls/TextBox.cs

@ -101,8 +101,8 @@ namespace Avalonia.Controls
public static readonly StyledProperty<object> InnerRightContentProperty =
AvaloniaProperty.Register<TextBox, object>(nameof(InnerRightContent));
public static readonly StyledProperty<bool> RevealPasswordTextProperty =
AvaloniaProperty.Register<TextBox, bool>(nameof(RevealPasswordText));
public static readonly StyledProperty<bool> RevealPasswordProperty =
AvaloniaProperty.Register<TextBox, bool>(nameof(RevealPassword));
struct UndoRedoState : IEquatable<UndoRedoState>
{
@ -347,10 +347,10 @@ namespace Avalonia.Controls
set { SetValue(InnerRightContentProperty, value); }
}
public bool RevealPasswordText
public bool RevealPassword
{
get { return GetValue(RevealPasswordTextProperty); }
set { SetValue(RevealPasswordTextProperty, value); }
get { return GetValue(RevealPasswordProperty); }
set { SetValue(RevealPasswordProperty, value); }
}
public TextWrapping TextWrapping

8
src/Avalonia.Themes.Fluent/TextBox.xaml

@ -96,7 +96,7 @@
TextAlignment="{TemplateBinding TextAlignment}"
TextWrapping="{TemplateBinding TextWrapping}"
PasswordChar="{TemplateBinding PasswordChar}"
RevealPasswordText="{TemplateBinding RevealPasswordText}"
RevealPassword="{TemplateBinding RevealPassword}"
SelectionBrush="{TemplateBinding SelectionBrush}"
SelectionForegroundBrush="{TemplateBinding SelectionForegroundBrush}"
CaretBrush="{TemplateBinding CaretBrush}"
@ -169,10 +169,10 @@
<Style Selector="TextBox.revealPasswordButton">
<Setter Property="InnerRightContent">
<Template>
<ToggleButton IsChecked="{Binding $parent[TextBox].RevealPasswordText, Mode=TwoWay}">
<ToggleButton IsChecked="{Binding $parent[TextBox].RevealPassword, Mode=TwoWay}">
<Panel Width="16" Height="16">
<DrawingPresenter Drawing="{DynamicResource EyeShowRegular}" IsVisible="{Binding $parent[TextBox].RevealPasswordText}"/>
<DrawingPresenter Drawing="{DynamicResource EyeHideRegular}" IsVisible="{Binding !$parent[TextBox].RevealPasswordText}"/>
<DrawingPresenter Drawing="{DynamicResource EyeShowRegular}" IsVisible="{Binding $parent[TextBox].RevealPassword}"/>
<DrawingPresenter Drawing="{DynamicResource EyeHideRegular}" IsVisible="{Binding !$parent[TextBox].RevealPassword}"/>
</Panel>
</ToggleButton>
</Template>

Loading…
Cancel
Save