BarItem & DataBindings

Hi, When i want to add 2 dataBindings to 2 baritem, an exception occurs. The code is : this.bi_print.DataBindings.Clear(); this.bi_printPreview.DataBindings.Clear(); this.bi_print.DataBindings.Add("Enabled", form, "CanPrint"); this.bi_printPreview.DataBindings.Add("Enabled", form, "CanPrintPreview"); The exception is : Une exception non gérée du type ''System.ArgumentException'' s''est produite dans system.windows.forms.dll Informations supplémentaires : Deux liaisons de la collection vont être liées à la même propriété. It occurs because the dataBindings collection of each baritem is the same. So when i add a dataBinding to "bi_print" baritem, it''s added to "bi_printPreview" baritem. Why ? How can i solve this problem (i use 3.2.1.0 version) ? Regards, Mikaël

3 Replies

AD Administrator Syncfusion Team October 13, 2005 01:19 PM UTC

Hi Mikael, Please implement the ICustomTypeDescriptor interface to support databinding for BarItems.I have attached a sample that illustrates this.Let me know if this meets your requirement. We appreciate your cooperation. Regards, Ebenezer.P

DataBinding.zip


MM Mikaël Morvan October 14, 2005 09:11 AM UTC

Hi, Now, this code works fine : this.DataBindings.Add(new System.Windows.Forms.Binding("MenuItem:Print.Text", form, "Text")); this.DataBindings.Add(new System.Windows.Forms.Binding("MenuItem:PrintPreview.Text", form, "Text")); but this one not work : this.DataBindings.Add(new System.Windows.Forms.Binding("MenuItem:Print.Enabled", form, "CanPrint")); this.DataBindings.Add(new System.Windows.Forms.Binding("MenuItem:PrintPreview.Enabled", form, "CanPrintPreview")); I can''t use databinding with the enabled properties of baritems. How can i make baritem support this databinding ? Regards, Mikaël


AD Administrator Syncfusion Team October 18, 2005 11:03 AM UTC

Hi Mikael, I am afraid it is possible to databind only the text and tooltip properties of the BarItem. We appreciate your cooperation. Regards, Ebenezer.P

Loader.
Up arrow icon