Silverlight Telerik RadCombobox RadGridView绑定问题

时间:2013-02-11 23:56:09

标签: silverlight telerik

我正在绑定一个可编辑的(您可以在其中键入以将项添加到选项列表中)radcombobox在radgridview的列中。它不会抛出绑定错误,但它不会更新绑定属性(Model.Remarks)

以下是课程

 public class NotamRemarkList : List<string>
    {
        public NotamRemarkList()
        {
            Add("Precision approaches are down; higher weather minimums apply.");
            Add("Due to runway closure, approaches available have higher minimums.");
            Add("All approaches are down; weather must be VFR.");
            Add("Long runway is closed; issue if the other runways are wet.");
            Add("Runway shortened; issue if wet.");
            Add("Airport will be closed at the time we are scheduled in.");
            Add("Runway lights are inoperative; night flights prohibited.");
        }

    }

 public class NotamViewModel
     { 
        [DataMember]
         public string NewStatus { get; set; }

        [DataMember]
         public Notam Model { get; set; }

        [DataMember]
         public string NotamGroup { get; set; }

        [DataMember]
         public int NotamCount { get; set; }

        [DataMember]
         public DateTime? EarliestNotamDepartureTime { get; set; } // min_dep_datetime

        [DataMember]
         public string RadioButtonGroupName { get; set; }
     }



public class Notam

 {         
         [DataMember]
         public string Remarks { get; set; }

         [DataMember]
         public string TripNumber { get; set; } 

        [DataMember]
         public string ArrivalDeparture { get; set; } 
} 

这是我为该列尝试的xaml - 第一个使用单元格模板,第二个尝试在列中执行所有操作

                <telerik:GridViewDataColumn Header="Remarks" IsFilterable="False" IsSortable="False" IsReadOnly="False" Width="430">
                    <telerik:GridViewDataColumn.CellTemplate>
                        <DataTemplate>
                            <telerik:RadComboBox SelectedValue="{Binding Model.Remarks, Mode=TwoWay}" ItemsSource="{StaticResource NotamRemarkList}" IsEditable="True"/>
                        </DataTemplate>
                    </telerik:GridViewDataColumn.CellTemplate>
                </telerik:GridViewDataColumn>

                <telerik:GridViewComboBoxColumn SelectedValueMemberPath="Model.Remarks" UniqueName="colRemarks"  IsComboBoxEditable="true" IsFilterable="False" IsSortable="False"/>

1 个答案:

答案 0 :(得分:0)

    public class Notam:INotifyPropertyChanged
{
    private string _remarks;
    [DataMember]
    public string Remarks
    {
     get {return _remarks;}
      set{
          _remarks=value ;
          if (PropertyChanged != null)
              PropertyChanged(this, new PropertyChangedEventArgs("Remarks"));
      }
}

    [DataMember]
    public string TripNumber { get; set; }

    [DataMember]
    public string ArrivalDeparture { get; set; }

    public event PropertyChangedEventHandler PropertyChanged;
} 

<telerik:RadComboBox SelectedValue="{Binding Model.Remarks, Mode=TwoWay}" SelectedValueMemberPath="Model.Remarks" ItemsSource="{StaticResource NotamRemarkList}" IsEditable="True"/>

我希望这会有所帮助。