|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using System.Collections.ObjectModel;
using System.Linq.Expressions;
using System.ComponentModel;
namespace NonVirtualizingTabControlDemo
{
/// <summary>
/// Interaction logic for MainWindow.xaml
/// </summary>
public partial class MainWindow : Window, INotifyPropertyChanged
{
public MainWindow()
{
InitializeComponent();
Items = new ObservableCollection<ColorInfo>();
DataContext = this;
}
#region Fields
private ColorInfo _current;
#endregion
#region Properties
public ColorInfo SelectedColor
{
get { return _current; }
set
{
_current = value;
if (!(Items as ObservableCollection<ColorInfo>).Contains(value))
(Items as ObservableCollection<ColorInfo>).Add(value);
PropertyChanged(this, new PropertyChangedEventArgs("SelectedColor"));
}
}
public IEnumerable<ColorInfo> Items { get; private set; }
#endregion
#region INotifyPropertyChanged Members
public event PropertyChangedEventHandler PropertyChanged = delegate { };
#endregion
}
}
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
Senior Software Engineer with over 20+ years of experience in variety of technologies, development tools and programming languages.
Microsoft Certified Specialist programming in C#, JavaScript, HTML, CSS