From 3e4b4ebad1e7b2d81d35da5f75198edd61ea10b9 Mon Sep 17 00:00:00 2001 From: jpbruyere Date: Mon, 14 Sep 2015 23:16:33 +0200 Subject: [PATCH] make use of binding for default window --- Templates/Window.goml | 6 +++--- Tests/Interfaces/testWindow.goml | 35 ++++++++------------------------ Tests/Tests.csproj | 3 +++ src/GraphicObjects/Window.cs | 33 ++++++++++++++++++++++-------- 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 @@ - - - + \ 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 @@  - - + - - - + + + + - - + + 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 @@ Tests.Interfaces.test7.goml PreserveNewest + + PreserveNewest + 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) -- 2.47.3