Browse Source

Added Styles class.

pull/4/head
grokys 12 years ago
parent
commit
3da3d4ab87
  1. 27
      Perspex/Controls/Control.cs
  2. 1
      Perspex/Perspex.csproj
  3. 12
      Perspex/Styles.cs
  4. 2
      TestApplication/Program.cs

27
Perspex/Controls/Control.cs

@ -59,6 +59,8 @@ namespace Perspex.Controls
internal static readonly PerspexProperty<Control> ParentPropertyRW =
PerspexProperty.Register<Control, Control>("Parent");
private Styles styles;
public Control()
{
this.Classes = new PerspexList<string>();
@ -104,10 +106,22 @@ namespace Perspex.Controls
private set;
}
public IEnumerable<Style> Styles
public Styles Styles
{
get;
set;
get
{
if (this.styles == null)
{
this.styles = new Styles();
}
return this.styles;
}
set
{
this.styles = value;
}
}
public Size? DesiredSize
@ -202,12 +216,9 @@ namespace Perspex.Controls
{
Contract.Requires<ArgumentNullException>(control != null);
if (control.Styles != null)
foreach (Style style in control.Styles)
{
foreach (Style style in control.Styles)
{
style.Attach(this);
}
style.Attach(this);
}
Control parent = control.Parent;

1
Perspex/Perspex.csproj

@ -101,6 +101,7 @@
<Compile Include="Rect.cs" />
<Compile Include="Controls\TemplatedControl.cs" />
<Compile Include="Style.cs" />
<Compile Include="Styles.cs" />
<Compile Include="Thickness.cs" />
<Compile Include="Visual.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />

12
Perspex/Styles.cs

@ -0,0 +1,12 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Perspex
{
public class Styles : PerspexList<Style>
{
}
}

2
TestApplication/Program.cs

@ -22,7 +22,7 @@ namespace TestApplication
Window window = new Window
{
Styles = new[]
Styles = new Styles
{
new Style
{

Loading…
Cancel
Save