Click here to Skip to main content
Click here to Skip to main content

Item-Level Presentation Models for WPF

By , 2 Apr 2011
 
using HappyNomad.PresentationModel;
using HappyNomad.Outlining;

namespace HappyNomad.Examples.PresentationModel.GUI.Model {

	public sealed class SampleTreeNodeView : HierarchicalPresentationModel<SampleTreeNode, SampleTreeNodeView> {

		#region Object Creation

		/// <summary>Creates a root-level SampleTreeNodeView.</summary>
		public SampleTreeNodeView() : this( SampleTreeNode.Root ) { }

		/// <summary>
		/// Creates a SampleTreeNodeView that does not (yet) have any sub-items.
		/// </summary>
		/// <param name="domainItem">The SampleTreeNode to be represented by this node</param>
		private SampleTreeNodeView( SampleTreeNode domainItem ) :
		  base( domainItem, domainItem.SubNodes, true, true, true ) { }

		/// <inheritdoc/>
		protected override SampleTreeNodeView CreateInstance( SampleTreeNode domainItem ) {
			return new SampleTreeNodeView( domainItem );
		}

		#endregion

		/// <inheritdoc/>
		protected override RelativePosition<SampleTreeNodeView> DesiredPosition( SampleTreeNode itemToAdd ) {
			//subItems.Insert( atPosition, itemToAdd );
			return new RelativePosition<SampleTreeNodeView>( OutliningCommands.NewChild, this, null );
		}
	}
}

By viewing downloads associated with this article you agree to the Terms of use 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 GNU General Public License (GPLv3)

About the Author

Adrian Alexander
United States United States
Member
Adrian loves facilitating suave user experiences via the latest and greatest GUI technologies such as Windows 8 Metro-style apps as well as WPF. More generally, he finds joy in architecting software that is easy to comprehend and maintain. He does so by applying design patterns at the top-level, and by incessantly refactoring code at lower levels. He's always interested in hearing about opportunities for full or part-time development work. He resides in Pennsylvania but can potentially travel anywhere in the country. (Writing about himself in the third-person is Adrian's new hobby.)

Permalink | Advertise | Privacy | Mobile
Web02 | 2.6.130516.1 | Last Updated 2 Apr 2011
Article Copyright 2008 by Adrian Alexander
Everything else Copyright © CodeProject, 1999-2013
Terms of Use
Layout: fixed | fluid