diff --git a/src/Resources/Styles/ComboBox.xaml b/src/Resources/Styles/ComboBox.xaml
index 2285841e..b2f36a3f 100644
--- a/src/Resources/Styles/ComboBox.xaml
+++ b/src/Resources/Styles/ComboBox.xaml
@@ -19,10 +19,6 @@
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/src/Views/Controls/TextEdit.cs b/src/Views/Controls/TextEdit.cs
index ff0146c9..07266bf3 100644
--- a/src/Views/Controls/TextEdit.cs
+++ b/src/Views/Controls/TextEdit.cs
@@ -1,8 +1,6 @@
-using System.Globalization;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Input;
-using System.Windows.Media;
namespace SourceGit.Views.Controls {
@@ -10,8 +8,6 @@ namespace SourceGit.Views.Controls {
/// 扩展默认TextBox
///
public class TextEdit : TextBox {
- private bool isPlaceholderShow = false;
-
public static readonly DependencyProperty PlaceholderProperty = DependencyProperty.Register(
"Placeholder",
typeof(string),
@@ -23,15 +19,15 @@ namespace SourceGit.Views.Controls {
set { SetValue(PlaceholderProperty, value); }
}
- public static readonly DependencyProperty PlaceholderBaselineProperty = DependencyProperty.Register(
- "PlaceholderBaseline",
- typeof(AlignmentY),
+ public static readonly DependencyProperty PlaceholderVisibilityProperty = DependencyProperty.Register(
+ "PlaceholderVisibility",
+ typeof(Visibility),
typeof(TextEdit),
- new PropertyMetadata(AlignmentY.Center));
+ new PropertyMetadata(Visibility.Visible));
- public AlignmentY PlaceholderBaseline {
- get { return (AlignmentY)GetValue(PlaceholderBaselineProperty); }
- set { SetValue(PlaceholderBaselineProperty, value); }
+ public Visibility PlaceholderVisibility {
+ get { return (Visibility)GetValue(PlaceholderVisibilityProperty); }
+ set { SetValue(PlaceholderVisibilityProperty, value); }
}
public TextEdit() {
@@ -39,41 +35,8 @@ namespace SourceGit.Views.Controls {
SelectionChanged += OnSelectionChanged;
}
- protected override void OnRender(DrawingContext dc) {
- base.OnRender(dc);
-
- if (string.IsNullOrEmpty(Text) && !string.IsNullOrEmpty(Placeholder)) {
- isPlaceholderShow = true;
-
- var text = new FormattedText(
- Placeholder,
- CultureInfo.CurrentCulture,
- FlowDirection.LeftToRight,
- new Typeface(new FontFamily(Models.Preference.Instance.General.FontFamilyWindow), FontStyle, FontWeight, FontStretch),
- FontSize,
- FindResource("Brush.FG2") as Brush,
- new NumberSubstitution(),
- TextFormattingMode.Display,
- VisualTreeHelper.GetDpi(this).PixelsPerDip);
-
- switch (PlaceholderBaseline) {
- case AlignmentY.Top:
- dc.DrawText(text, new Point(4, 4));
- break;
- case AlignmentY.Center:
- dc.DrawText(text, new Point(4, ActualHeight * .5 - text.Height * .5));
- break;
- default:
- dc.DrawText(text, new Point(4, ActualHeight - text.Height - 4));
- break;
- }
- } else {
- isPlaceholderShow = false;
- }
- }
-
private void OnTextChanged(object sender, TextChangedEventArgs e) {
- if (string.IsNullOrEmpty(Text) || isPlaceholderShow) InvalidateVisual();
+ PlaceholderVisibility = string.IsNullOrEmpty(Text) ? Visibility.Visible : Visibility.Collapsed;
}
private void OnSelectionChanged(object sender, RoutedEventArgs e) {
diff --git a/src/Views/Popups/CreateTag.xaml b/src/Views/Popups/CreateTag.xaml
index ae55f30a..21b969f3 100644
--- a/src/Views/Popups/CreateTag.xaml
+++ b/src/Views/Popups/CreateTag.xaml
@@ -66,7 +66,6 @@
Text="{Binding ElementName=me, Path=Message, Mode=TwoWay}"
Height="56" Padding="0,2"
AcceptsReturn="True"
- Placeholder="{DynamicResource Text.CreateTag.Message.Placeholder}"
- PlaceholderBaseline="Top"/>
+ Placeholder="{DynamicResource Text.CreateTag.Message.Placeholder}"/>
diff --git a/src/Views/Widgets/WorkingCopy.xaml b/src/Views/Widgets/WorkingCopy.xaml
index 90137893..cd350f6f 100644
--- a/src/Views/Widgets/WorkingCopy.xaml
+++ b/src/Views/Widgets/WorkingCopy.xaml
@@ -191,8 +191,9 @@
KeyDown="CommitMessageKeyDown"
ScrollViewer.HorizontalScrollBarVisibility="Disabled"
ScrollViewer.VerticalScrollBarVisibility="Auto"
- Placeholder="{DynamicResource Text.WorkingCopy.CommitMessageTip}"
- PlaceholderBaseline="Top">
+ Background="{DynamicResource Brush.Contents}"
+ BorderBrush="{DynamicResource Brush.Border2}"
+ Placeholder="{DynamicResource Text.WorkingCopy.CommitMessageTip}">