aboutsummaryrefslogtreecommitdiffstatsci
diff options
context:
space:
mode:
authorjpbruyere <jp.bruyere@hotmail.com>2015-09-14 23:16:33 +0200
committerjpbruyere <jp.bruyere@hotmail.com>2015-09-14 23:16:33 +0200
commit3e4b4ebad1e7b2d81d35da5f75198edd61ea10b9 (patch)
treed54e29e9e53e2e6d8f221a1bac8e0789e5214200
parentb2bef2567b1fa60ec7f9f91ab475fd0e02dbc834 (diff)
make use of binding for default window
-rwxr-xr-xTemplates/Window.goml6
-rwxr-xr-xTests/Interfaces/testWindow.goml35
-rw-r--r--Tests/Tests.csproj3
-rw-r--r--src/GraphicObjects/Window.cs33
4 files changed, 38 insertions, 39 deletions
diff --git a/Templates/Window.goml b/Templates/Window.goml
index 2f3711f1..46e82390 100755
--- a/Templates/Window.goml
+++ b/Templates/Window.goml
@@ -4,8 +4,8 @@
<Border BorderWidth="1" BorderColor="White" Height="-1" Background="0,1;0,5;1,0;0,5">
<HorizontalStack Name="hs" Margin="1" Spacing="1" Height="-1" >
<GraphicObject Width="5"/>
- <Image Name="Image" Margin="1" Width="12" Height="12" Path="#go.Images.Icons.tetra.png"/>
- <Label Foreground="White" Width="0" Name="Title" Margin="1" TextAlignment="Center" />
+ <Image Margin="1" Width="12" Height="12" Path="{Icon}"/>
+ <Label Foreground="White" Width="0" Margin="1" TextAlignment="Center" Text="{Title}" />
<Border CornerRadius="6" BorderWidth="1" BorderColor="Transparent" Height="12" Width="12"
MouseEnter="{BorderColor=White}" MouseLeave="{BorderColor=Transparent}">
<Image Focusable="true" Name="Image" Margin="0" Width="0" Height="0" Path="#go.Images.Icons.exit2.svg"
@@ -14,6 +14,6 @@
<GraphicObject Width="5"/>
</HorizontalStack>
</Border>
- <Container Name="Content"/>
+ <Container Name="Content" Background="0,5;0,5;0,5;0,5"/>
</VerticalStack>
</Border> \ No newline at end of file
diff --git a/Tests/Interfaces/testWindow.goml b/Tests/Interfaces/testWindow.goml
index b336a9dc..e6589bd5 100755
--- a/Tests/Interfaces/testWindow.goml
+++ b/Tests/Interfaces/testWindow.goml
@@ -1,36 +1,17 @@
<?xml version="1.0"?>
<!--<Group>-->
-<Window Name="window1" Left="10" Top="10" Title="Test window" Width="200" Height="200" Background="0,5;0,5;0,5;0,8"
- Focusable="True" CornerRadius="20" MinimumSize="100;100" MaximumSize="500;500">
- <Template>
- <Border BorderWidth="1" BorderColor="White" Margin="0" CornerRadius="20">
- <VerticalStack Margin="0">
- <Border BorderWidth="1" BorderColor="White" Height="-1" Background="0,1;0,5;1,0;0,5">
- <HorizontalStack Name="hs" Margin="1" Spacing="1" Height="-1" Focusable="false" >
- <GraphicObject Width="5" Height="0"/>
- <Image Name="Image" Margin="1" Width="12" Height="12" Path="#go.Images.Icons.tetra.png"/>
- <Label Foreground="White" Width="0" Name="Title" Margin="1" TextAlignment="Center" />
- <Border CornerRadius="6" BorderWidth="1" Margin="0" BorderColor="Transparent" Height="12" Width="12"
- MouseEnter="{BorderColor=White}" MouseLeave="{BorderColor=Transparent}">
- <Image Focusable="true" Name="Image" Margin="0" Width="0" Height="0" Path="#go.Images.Icons.exit2.svg"
- MouseClick="butQuitPress"/>
- </Border>
- <GraphicObject Width="5" Height="0"/>
- </HorizontalStack>
- </Border>
- <Container Name="Content" Margin="0" Width="0" Height="0"/>
- </VerticalStack>
- </Border>
- </Template>
+<Window Name="window1" Left="10" Top="10" Title="Test window"
+ Width="250" Height="300" >
<VerticalStack Name="contentVSStack" Margin="10" Spacing="10">
<Slider Name="slider" Height="10" Width="0"/>
- <HorizontalStack Width="-1" Height="-1" Margin="0" Background="Red">
- <Checkbox Height="-1" Width="100"/>
- <Checkbox Height="-1" Width="100"/>
+ <HorizontalStack Width="0" Height="-1" Margin="10" Background="BlueCrayola">
+ <Checkbox Height="-1" Width="80"/>
+ <GraphicObject Width="0"/>
+ <Checkbox Height="-1" Width="80"/>
</HorizontalStack>
- <GroupBox Title="test" Height="-1" Width="-1" Margin="5">
- <VerticalStack Height="-1" Width="-1">
+ <GroupBox Text="test" Height="-1" Width="0" Margin="5">
+ <VerticalStack Height="-1" Width="0">
<RadioButton Caption="Radio 1"/>
<RadioButton Caption="Radio 2" IsChecked="true"/>
<RadioButton Caption="Radio 3"/>
diff --git a/Tests/Tests.csproj b/Tests/Tests.csproj
index 210d0c8b..bf926a16 100644
--- a/Tests/Tests.csproj
+++ b/Tests/Tests.csproj
@@ -156,6 +156,9 @@
<LogicalName>Tests.Interfaces.test7.goml</LogicalName>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
+ <None Include="Interfaces\testWindow2.goml">
+ <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
+ </None>
</ItemGroup>
<ItemGroup>
<Folder Include="Interfaces\" />
diff --git a/src/GraphicObjects/Window.cs b/src/GraphicObjects/Window.cs
index 8355ff15..18ea1fd4 100644
--- a/src/GraphicObjects/Window.cs
+++ b/src/GraphicObjects/Window.cs
@@ -9,10 +9,19 @@ namespace go
[DefaultTemplate("#go.Templates.Window.goml")]
public class Window : TemplatedContainer
{
- Label _title;
- Image _icon;
+ string _title;
+ string _icon;
Container _contentContainer;
+ #region GraphicObject overrides
+ [XmlAttributeAttribute()][DefaultValue(true)]//overiden to get default to true
+ public override bool Focusable
+ {
+ get { return base.Focusable; }
+ set { base.Focusable = value; }
+ }
+ #endregion
+
public override GraphicObject Content {
get {
return _contentContainer == null ? null : _contentContainer.Child;
@@ -23,13 +32,21 @@ namespace go
}
[XmlAttributeAttribute()][DefaultValue("Window")]
public string Title {
- get { return _title.Text; }
+ get { return _title; }
set {
- if (_title == null)
- return;
- _title.Text = value;
+ _title = value;
+ NotifyValueChanged ("Title", _title);
}
- }
+ }
+ [XmlAttributeAttribute()][DefaultValue("#go.Images.Icons.tetra.png")]
+ public string Icon {
+ get { return _icon; }
+ set {
+ _icon = value;
+ NotifyValueChanged ("Icon", _icon);
+ }
+ }
+
public Window () : base()
{
}
@@ -170,8 +187,6 @@ namespace go
{
base.loadTemplate (template);
_contentContainer = this.child.FindByName ("Content") as Container;
- _title = this.child.FindByName ("Title") as Label;
- _icon = this.child.FindByName ("Icon") as Image;
}
protected void butQuitPress (object sender, MouseButtonEventArgs e)