为什么WPF支持绑定到对象的属性,而不支持字段?
[DataContract]public struct StatusInfo{ [DataMember] public int Total; [DataMember] public string Authority;}...public StatusInfo GetStatus() { ... }
public class ServiceViewModel : ViewModel{ public StatusInfo CurrentStatus { get{ return _currentStatus; } set { _currentStatus = value; OnPropertyChanged( () => CurrentStatus ); } } }
<TextBox Text="{Binding CurrentStatus.Total}" />
慕桂英4014372