\r
public override GraphicObject Content {\r
get { return _content; }\r
- set { _content = value; }\r
+ set { \r
+ if (_content != null) {\r
+ _content.LayoutChanged -= _content_LayoutChanged;\r
+ _content.MouseLeave -= _content_MouseLeave;\r
+ }\r
+ \r
+ _content = value; \r
+\r
+ if (_content == null)\r
+ return;\r
+\r
+ _content.Focusable = true;\r
+ _content.LayoutChanged += _content_LayoutChanged;\r
+ _content.MouseLeave += _content_MouseLeave;\r
+ }\r
+ }\r
+\r
+ void _content_MouseLeave (object sender, MouseMoveEventArgs e)\r
+ {\r
+ IsPopped = false;\r
+ }\r
+\r
+ void _content_LayoutChanged (object sender, LayoutChangeEventArgs e)\r
+ {\r
+ ILayoutable tc = Content.Parent as ILayoutable;\r
+ if (tc == null)\r
+ return;\r
+ Rectangle r = this.ScreenCoordinates (this.Slot);\r
+ if (e.LayoutType == LayoutingType.Width) {\r
+ if (Content.Slot.Width < tc.ClientRectangle.Width) {\r
+ if (r.Left + Content.Slot.Width > tc.ClientRectangle.Right)\r
+ Content.Left = tc.ClientRectangle.Right - Content.Slot.Width;\r
+ else\r
+ Content.Left = r.Left;\r
+ }else\r
+ Content.Left = 0;\r
+ }else if (e.LayoutType == LayoutingType.Height) {\r
+ if (Content.Slot.Height < tc.ClientRectangle.Height) {\r
+ if (r.Bottom + Content.Slot.Height > tc.ClientRectangle.Bottom)\r
+ Content.Top = r.Top - Content.Slot.Height;\r
+ else\r
+ Content.Top = r.Bottom;\r
+ }else\r
+ Content.Top = 0;\r
+ }\r
}\r
public Popper() : base()\r
{\r
} \r
- \r
+ public override void ClearBinding ()\r
+ {\r
+ //ensure popped window is cleared\r
+ if (Content != null) {\r
+ if (Content.Parent != null) {\r
+ IGOLibHost tc = Content.Parent as IGOLibHost;\r
+ if (tc != null)\r
+ tc.DeleteWidget (Content);\r
+ }\r
+ }\r
+\r
+ base.ClearBinding ();\r
+ }\r
+\r
[XmlAttributeAttribute()][DefaultValue(true)]//overiden to get default to true\r
public override bool Focusable\r
{\r
if (tc == null)\r
return;\r
if (Content != null) {\r
- Rectangle r = this.ScreenCoordinates (this.Slot);\r
Content.Visible = true;\r
- Content.Left = r.Left;\r
- Content.Top = r.Bottom;\r
tc.AddWidget (Content);\r
}\r
Pop.Raise (this, e);\r