Browse Source

Fix Font properties owner.

And make default values come from theme.
pull/16/head
Steven Kirk 12 years ago
parent
commit
b20b94160d
  1. 15
      Perspex.Controls/Presenters/TextPresenter.cs
  2. 9
      Perspex.Controls/TextBlock.cs
  3. 2
      Perspex.Themes.Default/WindowStyle.cs

15
Perspex.Controls/Presenters/TextPresenter.cs

@ -347,13 +347,16 @@ namespace Perspex.Controls
internal void CaretIndexChanged(int caretIndex)
{
this.caretBlink = true;
this.caretTimer.Stop();
this.caretTimer.Start();
this.InvalidateVisual();
if (this.GetVisualParent() != null)
{
this.caretBlink = true;
this.caretTimer.Stop();
this.caretTimer.Start();
this.InvalidateVisual();
var rect = this.FormattedText.HitTestTextPosition(caretIndex);
this.BringIntoView(rect);
var rect = this.FormattedText.HitTestTextPosition(caretIndex);
this.BringIntoView(rect);
}
}
private void MoveHorizontal(int count, ModifierKeys modifiers)

9
Perspex.Controls/TextBlock.cs

@ -17,16 +17,13 @@ namespace Perspex.Controls
Border.BackgroundProperty.AddOwner<TextBlock>();
public static readonly PerspexProperty<string> FontFamilyProperty =
PerspexProperty.Register<Control, string>("FontFamily", "Segoe UI", inherits: true);
PerspexProperty.Register<TextBlock, string>("FontFamily", inherits: true);
public static readonly PerspexProperty<double> FontSizeProperty =
PerspexProperty.Register<Control, double>(
"FontSize",
defaultValue: 12.0,
inherits: true);
PerspexProperty.Register<TextBlock, double>("FontSize", inherits: true);
public static readonly PerspexProperty<FontStyle> FontStyleProperty =
PerspexProperty.Register<Control, FontStyle>("FontStyle", inherits: true);
PerspexProperty.Register<TextBlock, FontStyle>("FontStyle", inherits: true);
public static readonly PerspexProperty<string> TextProperty =
PerspexProperty.Register<TextBlock, string>("Text");

2
Perspex.Themes.Default/WindowStyle.cs

@ -23,6 +23,8 @@ namespace Perspex.Themes.Default
Setters = new[]
{
new Setter(Window.TemplateProperty, ControlTemplate.Create<Window>(this.Template)),
new Setter(Window.FontFamilyProperty, "Segoe UI"),
new Setter(Window.FontSizeProperty, 12.0),
},
},
});

Loading…
Cancel
Save