public void CtorDelegate() { using (var del = new MyAlertViewDelegate()) using (var a = new UIAlertView("title", "message", del, null, null)) { Assert.That(a.Title, Is.EqualTo("title"), "Title"); Assert.That(a.Message, Is.EqualTo("message"), "Message"); Assert.NotNull(typeof(UIAlertView).GetField("__mt_WeakDelegate_var", BindingFlags.Instance | BindingFlags.NonPublic).GetValue(a), "backing field"); // check properties after the field (so we're not setting it only when calling the properties) Assert.NotNull(a.Delegate, "Delegate"); Assert.NotNull(a.WeakDelegate, "WeakDelegate"); } }
partial void maskBtnTapped(NSObject sender) { MyAlertViewDelegate alertViewDelegate = new MyAlertViewDelegate(this); UIAlertView alert = new UIAlertView("Mask:", "Please enter mask value.", alertViewDelegate, "Cancel", null); alert.AlertViewStyle = UIAlertViewStyle.PlainTextInput; alert.GetTextField(0).KeyboardType = UIKeyboardType.ASCIICapable; alert.GetTextField(0).Delegate = new MyTextFieldDelegate(this); alert.Tag = ALERT_VIEW_MASK; alert.AddButton("OK"); alert.Show(); }