From 1c833b7521f9b7a1b6a7221d6cfe87c914e43a7e Mon Sep 17 00:00:00 2001 From: "Frank A. Krueger" Date: Thu, 15 Jun 2017 23:35:58 -0700 Subject: [PATCH] Added Form --- Ooui/Form.cs | 17 +++++++++++++++++ Ooui/FormControl.cs | 10 ++++++++++ 2 files changed, 27 insertions(+) create mode 100644 Ooui/Form.cs diff --git a/Ooui/Form.cs b/Ooui/Form.cs new file mode 100644 index 0000000..5cde544 --- /dev/null +++ b/Ooui/Form.cs @@ -0,0 +1,17 @@ +using System; + +namespace Ooui +{ + public class Form : Element + { + public event EventHandler Submitted { + add => AddEventListener ("submit", value); + remove => RemoveEventListener ("submit", value); + } + + public Form () + : base ("form") + { + } + } +} diff --git a/Ooui/FormControl.cs b/Ooui/FormControl.cs index e98607e..7555d9f 100644 --- a/Ooui/FormControl.cs +++ b/Ooui/FormControl.cs @@ -16,6 +16,16 @@ namespace Ooui set => SetProperty (ref isDisabled, value, "disabled"); } + public Form Form { + get { + var p = ParentNode; + while (p != null && !(p is Form)) { + p = p.ParentNode; + } + return p as Form; + } + } + public FormControl (string tagName) : base (tagName) {