Click here to Skip to main content
15,896,063 members
Articles / Programming Languages / C#

MVVM (Part 2) - Commanding

Rate me:
Please Sign up or sign in to vote.
5.00/5 (1 vote)
1 Oct 2010CPOL5 min read 32.4K   278   16  
How to create Commands infrastructure in Silverlight

using System.Windows;
using System.Windows.Controls;

namespace SimpleControls
{
	public partial class TabHeaderControl : UserControl
	{
		private string header = string.Empty;
		public event RoutedEventHandler CloseMeEvent;

		public TabHeaderControl(string text)
		{
			header = text;
			InitializeComponent();
		}

		private void UserControl_Loaded(object sender, RoutedEventArgs e)
		{
			Label.Text = header;
		}

		private void Button_Click(object sender, RoutedEventArgs e)
		{
			if (CloseMeEvent != null)
			{
				CloseMeEvent(this, e);
			}
		}
	}
}

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.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
United States United States
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions