Browse Source

Moved some more properties out of Control.

Border and Foreground properties didn't make sense there.
pull/39/head
Steven Kirk 12 years ago
parent
commit
23c4a9a87f
  1. 18
      Perspex.Controls/Border.cs
  2. 27
      Perspex.Controls/Control.cs
  3. 27
      Perspex.Controls/Primitives/TemplatedControl.cs
  4. 9
      Perspex.Controls/TextBlock.cs
  5. 6
      Perspex.Themes.Default/TabItemStyle.cs

18
Perspex.Controls/Border.cs

@ -16,6 +16,12 @@ namespace Perspex.Controls
public static readonly PerspexProperty<Brush> BackgroundProperty =
PerspexProperty.Register<Border, Brush>("Background");
public static readonly PerspexProperty<Brush> BorderBrushProperty =
PerspexProperty.Register<Border, Brush>("BorderBrush");
public static readonly PerspexProperty<double> BorderThicknessProperty =
PerspexProperty.Register<Border, double>("BorderThickness");
static Border()
{
Control.AffectsRender(Border.BackgroundProperty);
@ -28,6 +34,18 @@ namespace Perspex.Controls
set { this.SetValue(BackgroundProperty, value); }
}
public Brush BorderBrush
{
get { return this.GetValue(BorderBrushProperty); }
set { this.SetValue(BorderBrushProperty, value); }
}
public double BorderThickness
{
get { return this.GetValue(BorderThicknessProperty); }
set { this.SetValue(BorderThicknessProperty, value); }
}
public override void Render(IDrawingContext context)
{
Brush background = this.Background;

27
Perspex.Controls/Control.cs

@ -20,15 +20,6 @@ namespace Perspex.Controls
public class Control : InputElement, ILogical, IStyleable, IStyleHost
{
public static readonly PerspexProperty<Brush> BorderBrushProperty =
PerspexProperty.Register<Control, Brush>("BorderBrush");
public static readonly PerspexProperty<double> BorderThicknessProperty =
PerspexProperty.Register<Control, double>("BorderThickness");
public static readonly PerspexProperty<Brush> ForegroundProperty =
PerspexProperty.Register<Control, Brush>("Foreground", new SolidColorBrush(0xff000000), inherits: true);
public static readonly PerspexProperty<Control> ParentProperty =
PerspexProperty.Register<Control, Control>("Parent");
@ -59,18 +50,6 @@ namespace Perspex.Controls
PseudoClass(InputElement.IsPointerOverProperty, ":pointerover");
}
public Brush BorderBrush
{
get { return this.GetValue(BorderBrushProperty); }
set { this.SetValue(BorderBrushProperty, value); }
}
public double BorderThickness
{
get { return this.GetValue(BorderThicknessProperty); }
set { this.SetValue(BorderThicknessProperty, value); }
}
public Classes Classes
{
get
@ -106,12 +85,6 @@ namespace Perspex.Controls
}
}
public Brush Foreground
{
get { return this.GetValue(ForegroundProperty); }
set { this.SetValue(ForegroundProperty, value); }
}
public string Id
{
get

27
Perspex.Controls/Primitives/TemplatedControl.cs

@ -18,6 +18,12 @@ namespace Perspex.Controls.Primitives
public static readonly PerspexProperty<Brush> BackgroundProperty =
Border.BackgroundProperty.AddOwner<TemplatedControl>();
public static readonly PerspexProperty<Brush> BorderBrushProperty =
Border.BorderBrushProperty.AddOwner<TemplatedControl>();
public static readonly PerspexProperty<double> BorderThicknessProperty =
Border.BorderThicknessProperty.AddOwner<TemplatedControl>();
public static readonly PerspexProperty<string> FontFamilyProperty =
TextBlock.FontFamilyProperty.AddOwner<TemplatedControl>();
@ -27,6 +33,9 @@ namespace Perspex.Controls.Primitives
public static readonly PerspexProperty<FontStyle> FontStyleProperty =
TextBlock.FontStyleProperty.AddOwner<TemplatedControl>();
public static readonly PerspexProperty<Brush> ForegroundProperty =
TextBlock.ForegroundProperty.AddOwner<TemplatedControl>();
public static readonly PerspexProperty<ControlTemplate> TemplateProperty =
PerspexProperty.Register<TemplatedControl, ControlTemplate>("Template");
@ -48,6 +57,18 @@ namespace Perspex.Controls.Primitives
set { this.SetValue(BackgroundProperty, value); }
}
public Brush BorderBrush
{
get { return this.GetValue(BorderBrushProperty); }
set { this.SetValue(BorderBrushProperty, value); }
}
public double BorderThickness
{
get { return this.GetValue(BorderThicknessProperty); }
set { this.SetValue(BorderThicknessProperty, value); }
}
public string FontFamily
{
get { return this.GetValue(FontFamilyProperty); }
@ -66,6 +87,12 @@ namespace Perspex.Controls.Primitives
set { this.SetValue(FontStyleProperty, value); }
}
public Brush Foreground
{
get { return this.GetValue(ForegroundProperty); }
set { this.SetValue(ForegroundProperty, value); }
}
public ControlTemplate Template
{
get { return this.GetValue(TemplateProperty); }

9
Perspex.Controls/TextBlock.cs

@ -25,6 +25,9 @@ namespace Perspex.Controls
public static readonly PerspexProperty<FontStyle> FontStyleProperty =
PerspexProperty.Register<TextBlock, FontStyle>("FontStyle", inherits: true);
public static readonly PerspexProperty<Brush> ForegroundProperty =
PerspexProperty.Register<TextBlock, Brush>("Foreground", new SolidColorBrush(0xff000000), inherits: true);
public static readonly PerspexProperty<string> TextProperty =
PerspexProperty.Register<TextBlock, string>("Text");
@ -77,6 +80,12 @@ namespace Perspex.Controls
set { this.SetValue(FontStyleProperty, value); }
}
public Brush Foreground
{
get { return this.GetValue(ForegroundProperty); }
set { this.SetValue(ForegroundProperty, value); }
}
public TextWrapping TextWrapping
{
get { return this.GetValue(TextWrappingProperty); }

6
Perspex.Themes.Default/TabItemStyle.cs

@ -22,8 +22,8 @@ namespace Perspex.Themes.Default
{
Setters = new[]
{
new Setter(TextBlock.FontSizeProperty, 28.7),
new Setter(Control.ForegroundProperty, Brushes.Gray),
new Setter(TabItem.FontSizeProperty, 28.7),
new Setter(TabItem.ForegroundProperty, Brushes.Gray),
new Setter(TabItem.TemplateProperty, ControlTemplate.Create<TabItem>(this.Template)),
},
},
@ -31,7 +31,7 @@ namespace Perspex.Themes.Default
{
Setters = new[]
{
new Setter(Control.ForegroundProperty, Brushes.Black),
new Setter(TabItem.ForegroundProperty, Brushes.Black),
},
},
});

Loading…
Cancel
Save