<?xml version="1.0"?>
<Popper Caption="{./Caption}" Background="{./Background}" PopDirection="{./Orientation}"
- Foreground = "{./Foreground}"
+ Foreground = "{./Foreground}" CanPop="{./HasChildren}"
Unpop = "{Foreground=LightGray;Background=Transparent}">
<Template>
<Label Text="{./Caption}"
Background="{./Background}"
Foreground="{./Foreground}"/>
</Template>
- <Border Foreground="LightGray" Fit="true">
+ <Border Foreground="DimGray" Fit="true">
<VerticalStack Name="ItemsContainer" Margin="2" Fit="true" Background="Onyx"/>
</Border>
</Popper>
// public event EventHandler Unpop;
string caption;
+ Command command;
+
+ [XmlAttributeAttribute()][DefaultValue(null)]
+ public virtual Command Command {
+ get { return command; }
+ set {
+ if (command == value)
+ return;
+ command = value;
+ NotifyValueChanged ("Command", command);
+ }
+ }
[XmlAttributeAttribute][DefaultValue("MenuItem")]
public string Caption {
NotifyValueChanged ("Caption", caption);
}
}
-// [XmlIgnore]
-// public virtual Alignment Orientation {
-// get { return Parent is Menu ? (Parent as Menu).Orientation : (Parent as MenuItem); }
-// }
Menu MenuRoot {
get {
}
#endregion
- bool _isPopped;
+ bool _isPopped, _canPop;
string caption;
Alignment popDirection;
GraphicObject _content;
}
}
+ [XmlAttributeAttribute()][DefaultValue(true)]
+ public bool CanPop
+ {
+ get { return _canPop; }
+ set
+ {
+ if (value == _canPop)
+ return;
+
+ _canPop = value;
+ NotifyValueChanged ("CanPop", _canPop);
+ }
+ }
[XmlAttributeAttribute()][DefaultValue(Alignment.Bottom)]
public virtual Alignment PopDirection {
get { return popDirection; }
public override void onMouseClick (object sender, MouseButtonEventArgs e)
{
- IsPopped = !IsPopped;
+ if (_canPop)
+ IsPopped = !IsPopped;
base.onMouseClick (sender, e);
}
public override void onMouseLeave (object sender, MouseMoveEventArgs e)
public virtual void AddItem(GraphicObject g){
items.AddChild (g);
+ NotifyValueChanged ("HasChildren", true);
//g.LogicalParent = this;
}
public virtual void RemoveItem(GraphicObject g)
{
items.RemoveChild (g);
+ if (items.Children.Count == 0)
+ NotifyValueChanged ("HasChildren", false);
}
public virtual void ClearItems()
{
items.ClearChildren ();
+ NotifyValueChanged ("HasChildren", false);
}
protected override void loadTemplate(GraphicObject template = null)
items = this.child.FindByName ("ItemsContainer") as Group;
if (items == null)
throw new Exception ("TemplatedGroup template Must contain a Group named 'ItemsContainer'");
+ if (items.Children.Count == 0)
+ NotifyValueChanged ("HasChildren", false);
+ else
+ NotifyValueChanged ("HasChildren", true);
}
#region GraphicObject overrides