0

我在 radgridview 的列中绑定了一个可编辑的(您可以输入它以将项目添加到选项列表中)radcombobox。它不会引发绑定错误,但不会更新绑定属性(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"/>
4

1 回答 1

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"/>

我希望这将有所帮助。

于 2013-02-13T02:16:40.477 回答