|
using System;
using System.ComponentModel;
using System.Windows.Input;
using System.Windows.Controls;
namespace SimpleAttendance
{
public class AttendanceTabHeaderModel : INotifyPropertyChanged
{
public AttendanceTabHeaderModel()
{
// Set the command properties
CloseTabCommand = new DelegateCommand(CloseTab, CanCloseTab);
}
// Commands
#region CloseTabCommand
public ICommand CloseTabCommand { get; set; }
public void CloseTab(object param)
{
// Remove this TabItem from the Tab control
objTabControl.Items.Remove(objTabItem);
}
private bool CanCloseTab(object param)
{
return true;
}
#endregion
// Properties
#region HeaderDisplay
private string _HeaderDisplay = @"Friday 1/1/2010";
public string HeaderDisplay
{
get { return _HeaderDisplay; }
set
{
if (HeaderDisplay == value)
{
return;
}
_HeaderDisplay = value;
this.NotifyPropertyChanged("HeaderDisplay");
}
}
#endregion
#region objTabItem
private TabItem _objTabItem;
public TabItem objTabItem
{
get { return _objTabItem; }
set
{
if (objTabItem == value)
{
return;
}
_objTabItem = value;
this.NotifyPropertyChanged("objTabItem");
}
}
#endregion
#region objTabControl
private TabControl _objTabControl;
public TabControl objTabControl
{
get { return _objTabControl; }
set
{
if (objTabControl == value)
{
return;
}
_objTabControl = value;
this.NotifyPropertyChanged("objTabControl");
}
}
#endregion
// Utility
#region INotifyPropertyChanged
public event PropertyChangedEventHandler PropertyChanged;
private void NotifyPropertyChanged(String info)
{
if (PropertyChanged != null)
{
PropertyChanged(this, new PropertyChangedEventArgs(info));
}
}
#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.