⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 bmbutton.cs

📁 学习WPF的好东西
💻 CS
字号:
using System;
using System.Collections.Generic;
using System.Text;
using System.ComponentModel;
using System.Collections.ObjectModel;
using System.Windows;
using System.Windows.Controls;

namespace DTSample
{
    class BindingClass// : INotifyPropertyChanged
    {
        public BindingClass(string c, double h)
        {
            content = c;
            height = h;
        }
        public BindingClass()
        {
            content = "default binding";
            height = 0;
        }

        
        private string content;
        public string Content
        {
            get { return content; }
            set 
            { 
                content = value; 
               // OnPropertyChanged("content"); 
            }
        }

        
        private double height;
        public double Height
        {
            get { return height; }
            set 
            { 
                height = value; 
                //OnPropertyChanged("Height"); 
            }
        }
       
       
        
        //public event PropertyChangedEventHandler PropertyChanged;
        //private void OnPropertyChanged(String info)
        //{
        //    if (PropertyChanged != null)
        //        PropertyChanged(this, new PropertyChangedEventArgs(info));
        //}

        //public override string ToString()
        //{
        //    return Content;
        //}



    }

    
    class BindingList : ObservableCollection<BindingClass>
    {
        public BindingList()
        {
            base.Add(new BindingClass("hello",1));
            base.Add(new BindingClass("happy",2));
            base.Add(new BindingClass("happy", 3));
            base.Add(new BindingClass("happy", 4));

        }
    }

    
    
    //class BindingList : List<BindingClass>
    //{ 
    //}

    //public class ItemTemplateSelector : DataTemplateSelector
    //{
    //    public override DataTemplate SelectTemplate(object item, DependencyObject container)
    //    {
    //        if (item != null && item is BindingClass)
    //        {
    //            BindingClass taskitem = item as BindingClass;
    //            Window window = Application.Current.MainWindow;

    //            if (taskitem.Content == "hello")
    //                return
    //                    window.FindResource("Template1") as DataTemplate;
    //            else
    //                return
    //                    window.FindResource("Template2") as DataTemplate;
    //        }

    //        return null;


    //    }

    //}

}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -