zoukankan      html  css  js  c++  java
  • 1、ViewModel类的构建和INoyifyPropertyChanged的应用

    public class SampleItem : INotifyPropertyChanged
        {
            public SampleItem()
            {
            }
    
    
            private string title;
            public string Title
            {
                get { return title; }
                set
                {
                    if (value != title)
                    {
                        title = value;
                        NotifyPropertyChanged("Title");
                    }
                }
            }
    
            private string subTitle;
            public string SubTitle
            {
                get { return subTitle; }
                set
                {
                    if (value != subTitle)
                    {
                        subTitle = value;
                        NotifyPropertyChanged("SubTitle");
                    }
                }
            }
    
            private string itemImage;
            public string ItemImage
            {
                get { return itemImage; }
                set
                {
                    if (value != itemImage)
                    {
                        itemImage = value;
                        NotifyPropertyChanged("ItemImage");
                    }
                }
            }
    
            private string gprop;
            public string TargetGroup
            {
                get { return gprop; }
                set
                {
                    if (value != gprop)
                    {
                        gprop = value;
                        NotifyPropertyChanged("TargetGroup");
                    }
                }
            }
    
            private ObservableCollection<SampleItem> items = new ObservableCollection<SampleItem>();
            public ObservableCollection<SampleItem> Items
            {
                get { return items; }
                set
                {
                    if (value != items)
                    {
                        items = value;
                        NotifyPropertyChanged("Items");
                    }
                }
            }
    
            public event PropertyChangedEventHandler PropertyChanged;
            protected void NotifyPropertyChanged(String info)
            {
                if (PropertyChanged != null)
                {
                    PropertyChanged(this, new PropertyChangedEventArgs(info));
                }
            }
  • 相关阅读:
    摄像头标定GML Camera Calibration
    joda.money.Money
    aop the less note 1
    good notes
    yingyu biji 1
    flowable note1
    activiti note1
    CET4/6
    Web应用界面好帮手!DevExtreme React和Vue组件全新功能上线
    Web UI开发推荐!Kendo UI for jQuery自定义小部件——处理事件
  • 原文地址:https://www.cnblogs.com/NEIL-X/p/4149579.html
Copyright © 2011-2022 走看看