日期:2014-05-18 浏览次数:21525 次
public class Actor : INotifyPropertyChanged
    {
        public event PropertyChangedEventHandler PropertyChanged;
        private int life;
        public int Life
        {
            get { return life; }
            set
            {
                life = value;
                if (PropertyChanged != null)
                    PropertyChanged.Invoke(this, new PropertyChangedEventArgs("Life"));
            }
        }
    }
    public class Actors : Collection<Actor>
    { }
    <Window.Resources>
        <local:Actors x:Key="Actors">
            <local:Actor x:Name="Actor1"/>
            <local:Actor x:Name="Actor2"/>
        </local:Actors>
    </Window.Resources>
<TextBlock Text="{Binding ElementName={StaticResource Actors} Path=???}"/><!-- 请问这里的Binding应该如何写? -->