I have this code to create Button in a UltraMonthViewSingle, I use click event of embebded ButtonUIElement to change the Text of it,But when I change the Form size (maximum Form) or click on other UIElement (DayNUmberUIElement, Owner),the Text of ButtonUIElement return to its orginial value.Help me to solve this problem, please.Thank you.public void AfterCreateChildElements(UIElement parent) { if (parent is TimeSlotUIElement) { ButtonUIElement txtUI = new ButtonUIElement(parent); txtUI.Rect = parent.Rect; txtUI.Text = "OK"; txtUI.ElementClick += OnEmbeddedButtonClicked; parent.ChildElements.Add(txtUI); } }protected virtual void OnEmbeddedButtonClicked(object sender, UIElementEventArgs e) { if (e.Element.GetType() == typeof(Infragistics.Win.ButtonUIElement)) { ButtonUIElement btn = e.Element as ButtonUIElement; if (btn.Text == "OK") btn.Text = "CH"; }
thank you
When the button is clicked, you set the Text on the instance that was set, but that instance will be removed each time the control's elements are regenerated. You have to persist the value of the Text property globally, and then access that persisted value when setting it in AfterCreateChildElements.
Is there any solution for this? Many thanks
Please answer this