locked
Bindable Attribute RRS feed

  • Question

  •  Hi,

     I'm trying the new controls of SL3 and I've seen a nice demo of the DataForm.

    I downloaded several samples but I always have an error on the "Bindable" key word.

     [Bindable(true, BindableDirection.TwoWay)]
     [Display(Name="Your user name", Description="Blabla....")]
     [Required(ErrorMessage="Blabla....")]
     public string UserName { get; set;}

    How to use "Bindable" exactly ? Which reference, which using ?

    Thx in advance

    Best regards,

    desopedr

    Tuesday, August 11, 2009 5:57 AM

Answers

  •  Following is taken from Silverlight 3 docs.. For more visit here: http://msdn.microsoft.com/en-us/library/cc645049(VS.95).aspx

    3.13 BindableAttribute and BindingDirection have been removed

    In Silverlight 3 Beta, the Bindable attribute was used to annotate the properties of a business object allowing the UI to react in two ways:

    • To treat the property as read only in the UI.

    • To tell controls that perform auto-generation, such as DataGrid and DataForm, if they should generate UI for the property.

    In the Silverlight 3 release, the Editable and Display attributes should be used for these purposes.

    Marking a property as ReadOnly in the UI:

    Before (C#)

    After

    [Bindable (true, BindingDirection.OneWay)]

    public string myString {get;set;}

    [Editable (false)]

    public string myString {get;set;}

    Marking a property to not have controls auto-generate UI for it:

    Before (C#)

    After

    [Bindable (false)]

    public int myInt {get;set;}

    [Display (AutoGenerateField=false)]

    public int bar {get;set;}

    Tuesday, August 11, 2009 6:10 AM