Browse Source

whitespace.

pull/1544/head
Dan Walmsley 8 years ago
parent
commit
a9747e0bd6
  1. 6
      samples/ControlCatalog/Pages/TextBoxPage.xaml
  2. 14
      src/Avalonia.Controls/TextBox.cs
  3. 6
      src/Avalonia.Themes.Default/TextBox.xaml

6
samples/ControlCatalog/Pages/TextBoxPage.xaml

@ -10,8 +10,8 @@
<StackPanel Orientation="Vertical" Gap="8">
<TextBox Text="Lorem ipsum dolor sit amet, consectetur adipiscing elit." Width="200" />
<TextBox Width="200" Watermark="Watermark" />
<TextBox Width="200"
Watermark="Floating Watermark"
<TextBox Width="200"
Watermark="Floating Watermark"
UseFloatingWatermark="True"
Text="Lorem ipsum dolor sit amet, consectetur adipiscing elit."/>
@ -22,7 +22,7 @@
Text="Password" />
<TextBox Width="200" Text="Left aligned text" TextAlignment="Left" />
<TextBox Width="200" Text="Center aligned text" TextAlignment="Center" />
<TextBox Width="200" Text="Right aligned text" TextAlignment="Right" />
<TextBox Width="200" Text="Right aligned text" TextAlignment="Right" />
</StackPanel>
<StackPanel Orientation="Vertical" Gap="8">

14
src/Avalonia.Controls/TextBox.cs

@ -32,7 +32,7 @@ namespace Avalonia.Controls
(o, v) => o.CaretIndex = v);
public static readonly StyledProperty<char> PasswordCharProperty =
AvaloniaProperty.Register<TextBox, char>(nameof(PasswordChar));
AvaloniaProperty.Register<TextBox, char>(nameof(PasswordChar));
public static readonly StyledProperty<bool> IsReadOnlyProperty =
AvaloniaProperty.Register<TextBox, bool>(nameof(IsReadOnly));
@ -84,7 +84,7 @@ namespace Avalonia.Controls
public bool Equals(UndoRedoState other) => ReferenceEquals(Text, other.Text) || Equals(Text, other.Text);
}
private string _text;
private int _caretIndex;
private int _selectionStart;
@ -93,7 +93,7 @@ namespace Avalonia.Controls
private UndoRedoHelper<UndoRedoState> _undoRedoHelper;
private bool _isUndoingRedoing;
private bool _ignoreTextChanges;
private static readonly string[] invalidCharacters = new String[1]{"\u007f"};
private static readonly string[] invalidCharacters = new String[1] { "\u007f" };
static TextBox()
{
@ -267,7 +267,7 @@ namespace Avalonia.Controls
_presenter = e.NameScope.Get<TextPresenter>("PART_TextPresenter");
_presenter.Cursor = new Cursor(StandardCursorType.Ibeam);
if(IsFocused)
if (IsFocused)
{
_presenter.ShowCaret();
}
@ -608,7 +608,7 @@ namespace Avalonia.Controls
DataValidationErrors.SetError(this, status.Error);
}
}
private int CoerceCaretIndex(int value) => CoerceCaretIndex(value, Text?.Length ?? 0);
private int CoerceCaretIndex(int value, int length)
@ -862,9 +862,9 @@ namespace Avalonia.Controls
private void SetTextInternal(string value)
{
try
{
{
_ignoreTextChanges = true;
SetAndRaise(TextProperty, ref _text, value);
SetAndRaise(TextProperty, ref _text, value);
}
finally
{

6
src/Avalonia.Themes.Default/TextBox.xaml

@ -11,7 +11,7 @@
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}">
<DockPanel Margin="{TemplateBinding Padding}">
<TextBlock Name="floatingWatermark"
Foreground="{DynamicResource ThemeAccentBrush}"
FontSize="{DynamicResource FontSizeSmall}"
@ -31,7 +31,7 @@
<DataValidationErrors>
<ScrollViewer HorizontalScrollBarVisibility="{TemplateBinding (ScrollViewer.HorizontalScrollBarVisibility)}"
VerticalScrollBarVisibility="{TemplateBinding (ScrollViewer.VerticalScrollBarVisibility)}">
<Panel>
<TextBlock Name="watermark"
Opacity="0.5"
@ -43,7 +43,7 @@
SelectionStart="{TemplateBinding SelectionStart}"
SelectionEnd="{TemplateBinding SelectionEnd}"
TextAlignment="{TemplateBinding TextAlignment}"
TextWrapping="{TemplateBinding TextWrapping}"/>
TextWrapping="{TemplateBinding TextWrapping}"/>
</Panel>
</ScrollViewer>
</DataValidationErrors>

Loading…
Cancel
Save