none
DataForm绑定的问题,向各位求教。 RRS feed

  • 问题

  • 正在尝试http://silverlight.net/learn/learnvideo.aspx?video=187317 中介绍的DataForm绑定方法,出现了意想不到的问题。

     [Bindable(true, BindingDirection.TwoWay)]
    不能被vs识别。

    查msdn得知,Bindable是System.ComponentModel 命名空间下的一个类。但不知为何,始终提示“无法识别该类,没有引用命名空间“,但已经using该空间。

    请问,如何解决此问题?
    2009年7月27日 10:23

答案

  • 你好,
    这个属性在RTW中去掉了.你看的视频是针对Beta版本的.

    Attributes

    In the Silverlight 3 Beta new attributes were introduced, that were to help you easily work with data. One of them was the Bindable attribute. Its purpose was to annotate if a property of a business object should be auto-generated in the UI and should it be editable:

    //The proeprty Username can be auto-generated in the UI,
    //but is not editable, because of the one way binding.
     
    [Bindable (true, BindingDirection.OneWay)] 
    public string Username 
    {
        get;
        set;
    }

    The attribute is now removed from the final release and its functions are taken by the Display and Editable attributes – the first one can annotate if the property should be auto-generated in the UI and the second annotates if the property should be read-only in the UI:

    //The Username property can be auto-generated in the UI.
    [ Display( AutoGenerateField = true ) ]
    //The Username property is read only.
    [ Editable( false ) ]
    public string Username 
    {
        get;
        set;
    }



    http://www.silverlightshow.net/items/Silverlight-3-RTW-overview.aspx
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.
    2009年7月29日 10:36
    版主

全部回复