Click here to Skip to main content
15,897,704 members
Articles / Desktop Programming / WPF

WPF Control State Persistency

Rate me:
Please Sign up or sign in to vote.
4.61/5 (11 votes)
9 Jun 20073 min read 125.1K   651   37  
This article describes how to store and restore WPF's elements state, such as position, size, etc.
using System;
using System.Collections.Generic;
using System.Text;
using System.Collections.ObjectModel;

namespace Tomers.WPF.State.Demo.Data
{
	class Consultants : ObservableCollection<Consultant>
	{
		public Consultants()
		{
			Add(new Consultant("Tomer", "Shamam", "http://blogs.microsoft.co.il/blogs/tomershamam"));
			Add(new Consultant("Alon", "Flies", "http://blogs.microsoft.co.il/blogs/alon"));
			Add(new Consultant("Emanuel", "Cohen-Yashar", "http://blogs.microsoft.co.il/blogs/applisec"));
			Add(new Consultant("Noam", "King", "http://blogs.microsoft.co.il/blogs/noam"));
		}
	}

	class Consultant
	{
		private string _firstName;
		public string FirstName
		{
			get { return _firstName; }
		}

		private string _lastName;
		public string LastName
		{
			get { return _lastName; }
		}

		private string _blog;
		public string Blog
		{
			get { return _blog; }
		}

		public Consultant(string firstName, string lastName, string blog)
		{
			this._firstName = firstName;
			this._lastName = lastName;
			this._blog = blog;
		}
	}
}

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 has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here


Written By
Architect CodeValue
Israel Israel
Tomer Shamam is a Software Architect and a UI Expert at CodeValue, the home of software experts, based in Israel (http://codevalue.net). Tomer is a speaker in Microsoft conferences and user groups, and in-house courses. Tomer has years of experience in software development, he holds a B.A degree in computer science, and his writings appear regularly in the Israeli MSDN Pulse, and other popular developer web sites such as CodePlex and The Code Project. About his thoughts and ideas you can read in his blog (http://blogs.microsoft.co.il/blogs/tomershamam).

Comments and Discussions