aboutsummaryrefslogtreecommitdiffstatsci
path: root/src/GraphicObjects/Checkbox.cs
diff options
context:
space:
mode:
authorjpbruyere <jp.bruyere@hotmail.com>2015-09-14 17:55:46 +0200
committerjpbruyere <jp.bruyere@hotmail.com>2015-09-14 17:55:46 +0200
commit01ec9f5a3fa94df22844e22f47cd4853959fe99e (patch)
tree511fd0caf9ff685ddeb24f4dc4ef63b958c2ad8c /src/GraphicObjects/Checkbox.cs
parente568d1381aba02054acd3e267f42d319f161d59e (diff)
* Tests.csproj:
* GOLIBTests.cs: * Popper.goml: * Checkbox.goml: * Expandable.goml: * RadioButton.goml: * test7.goml: * Popper.cs: * test4.1.goml: * test1.3.goml: * Checkbox.cs: * Expandable.cs: * RadioButton.cs: * testCheckbox.goml: * testRadioButton.goml: improve templates, set SvgSub as PropertyLess binding updated with only * radiobutton.svg: simplify svg
Diffstat (limited to 'src/GraphicObjects/Checkbox.cs')
-rw-r--r--src/GraphicObjects/Checkbox.cs85
1 files changed, 45 insertions, 40 deletions
diff --git a/src/GraphicObjects/Checkbox.cs b/src/GraphicObjects/Checkbox.cs
index 863cae0c..d4deb171 100644
--- a/src/GraphicObjects/Checkbox.cs
+++ b/src/GraphicObjects/Checkbox.cs
@@ -19,51 +19,18 @@ namespace go
[DefaultTemplate("#go.Templates.Checkbox.goml")]
public class Checkbox : TemplatedControl
{
- Label _caption;
- Image _image;
+ string caption;
+ string image;
+ bool isChecked;
+ #region CTOR
public Checkbox() : base()
{
- }
-
- protected override void loadTemplate(GraphicObject template = null)
- {
- base.loadTemplate (template);
-
- _caption = this.child.FindByName ("Caption") as Label;
- _image = this.child.FindByName ("Image") as Image;
- _image.SvgSub = "unchecked";
- }
-
-
- [XmlAttributeAttribute()][DefaultValue("Checkbox")]
- public string Caption {
- get { return _caption == null ? "" : _caption.Text; }
- set {
- if (_caption == null)
- return;
- _caption.Text = value;
- }
- }
- [XmlAttributeAttribute()][DefaultValue(false)]
- public bool IsChecked
- {
- get { return _image == null ? false :_image.SvgSub == "checked"; }
- set
- {
- if (value == IsChecked)
- return;
+ }
+ #endregion
- if (value)
- _image.SvgSub = "checked";
- else
- _image.SvgSub = "unchecked";
-
- NotifyValueChanged("IsChecked", IsChecked);
- //registerForGraphicUpdate();
- }
- }
+ #region GraphicObject overrides
[XmlAttributeAttribute()][DefaultValue(-1)]
public override int Height {
get { return base.Height; }
@@ -75,6 +42,44 @@ namespace go
get { return base.Focusable; }
set { base.Focusable = value; }
}
+ #endregion
+
+ [XmlAttributeAttribute()][DefaultValue("Checkbox")]
+ public string Caption {
+ get { return caption; }
+ set {
+ if (caption == value)
+ return;
+ caption = value;
+ NotifyValueChanged ("Caption", caption);
+ }
+ }
+ [XmlAttributeAttribute()][DefaultValue("#go.Images.Icons.checkbox.svg")]
+ public string Image {
+ get { return image; }
+ set {
+ if (image == value)
+ return;
+ image = value;
+ NotifyValueChanged ("Image", image);
+ }
+ }
+
+ [XmlAttributeAttribute()][DefaultValue(false)]
+ public bool IsChecked
+ {
+ get { return isChecked; }
+ set
+ {
+ isChecked = value;
+
+ NotifyValueChanged ("IsChecked", value);
+ if (isChecked)
+ NotifyValueChanged ("SvgSub", "checked");
+ else
+ NotifyValueChanged ("SvgSub", "unchecked");
+ }
+ }
public override void onMouseClick (object sender, MouseButtonEventArgs e)
{
IsChecked = !IsChecked;