Hi,
ich möchte eine TAction Komponente programmieren und möchte bestimmete Felder über ein Databinding im Entwurfsmodus verbinden. Im Designer des Entwurfsmodus wird alles korrekt erstellt, aber zur Laufzeit verschwindet der Wert. Kann mir jemand sagen, warum das so nicht funktioniert ?
Vielen Dank.
ich möchte eine TAction Komponente programmieren und möchte bestimmete Felder über ein Databinding im Entwurfsmodus verbinden. Im Designer des Entwurfsmodus wird alles korrekt erstellt, aber zur Laufzeit verschwindet der Wert. Kann mir jemand sagen, warum das so nicht funktioniert ?
Vielen Dank.
Code:
using System.ComponentModel; using System.Windows.Forms; namespace WindowsFormsApplication1 { public partial class TestDataBinding : Component, IBindableComponent { public string TestFeld { get; set; } public TestDataBinding() { } private BindingContext bindingContext; private ControlBindingsCollection dataBindings; [Browsable(false)] public BindingContext BindingContext { get { if (bindingContext == null) { bindingContext = new BindingContext(); } return bindingContext; } set { bindingContext = value; } } [DesignerSerializationVisibility(DesignerSerializationVisibility.Content)] public ControlBindingsCollection DataBindings { get { if (dataBindings == null) { dataBindings = new ControlBindingsCollection(this); } return dataBindings; } } } }