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));
                }
            }
  • 相关阅读:
    velocity导出word报错解决
    Java解析网段下包含的所有IP地址
    ORACLE中的DECODE函数
    td标签内的内容过长导致的问题的解决办法
    android 知识点
    geekNews 学习总结
    android 操蛋的gradle
    rxJava rxandroid 学习
    线程池ThreadPoolExecutor
    j2ee tomcat 部署学习
  • 原文地址:https://www.cnblogs.com/NEIL-X/p/4149579.html
Copyright © 2011-2022 走看看