Browse Source

Remove TextBox hacks.

Now that we can have attached properties in bindings.
pull/484/head
Steven Kirk 10 years ago
parent
commit
f2ecce6cc2
  1. 10
      src/Perspex.Controls/TextBox.cs
  2. 6
      src/Perspex.Themes.Default/TextBox.xaml

10
src/Perspex.Controls/TextBox.cs

@ -26,16 +26,6 @@ namespace Perspex.Controls
public static readonly StyledProperty<bool> AcceptsTabProperty =
PerspexProperty.Register<TextBox, bool>("AcceptsTab");
// TODO: Remove these when "(attached.property)" syntax is supported in bindings. They are
// bound to in the TextBox template, but ideally they should just be bound to the attached
// property.
public static readonly StyledProperty<bool> CanScrollHorizontally =
ScrollViewer.CanScrollHorizontallyProperty.AddOwner<TextBox>();
public static readonly StyledProperty<ScrollBarVisibility> HorizontalScrollBarVisibilityProperty =
ScrollViewer.HorizontalScrollBarVisibilityProperty.AddOwner<TextBox>();
public static readonly StyledProperty<ScrollBarVisibility> VerticalScrollBarVisibilityProperty =
ScrollViewer.VerticalScrollBarVisibilityProperty.AddOwner<TextBox>();
// TODO: Should CaretIndex, SelectionStart/End and Text be direct properties?
public static readonly StyledProperty<int> CaretIndexProperty =
PerspexProperty.Register<TextBox, int>("CaretIndex", validate: ValidateCaretIndex);

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

@ -28,9 +28,9 @@
</TextBlock.IsVisible>
</TextBlock>
<ScrollViewer CanScrollHorizontally="{TemplateBinding CanScrollHorizontally}"
HorizontalScrollBarVisibility="{TemplateBinding HorizontalScrollBarVisibility}"
VerticalScrollBarVisibility="{TemplateBinding VerticalScrollBarVisibility}">
<ScrollViewer CanScrollHorizontally="{TemplateBinding (ScrollViewer.CanScrollHorizontally)}"
HorizontalScrollBarVisibility="{TemplateBinding (ScrollViewer.HorizontalScrollBarVisibility)}"
VerticalScrollBarVisibility="{TemplateBinding (ScrollViewer.VerticalScrollBarVisibility)}">
<Panel>
<TextBlock Name="watermark"
Opacity="0.5"

Loading…
Cancel
Save