Click here to Skip to main content
15,881,173 members
Articles / Desktop Programming / WPF

XPlorerBar : Part 2 - Adding design-time support to the WPF explorer bar control

Rate me:
Please Sign up or sign in to vote.
4.98/5 (50 votes)
22 Dec 2008CPOL14 min read 95.9K   2.7K   109  
This library provides Visual Studio 2008 design-time support to customize WPF XPlorerBar features.
#region [       Copyright © 2008, Zona-Tools, all rights reserved.       ]
/*
 * 
    This source code is licensed under the Code Project Open License (CPOL).
    Check out http://www.codeproject.com/info/cpol10.aspx for further details.
 * 
*/
#endregion


#region [       Using namespaces       ]

using Microsoft.Windows.Design.Model;

#endregion


namespace ZonaTools.XPlorerBar.VisualStudio.Design
{
    /// <summary>
    /// Initializes the properties of a new <c>XPlorerBar</c> created in the designer.
    /// </summary>
    internal class XPlorerBarDefaultInitializer : DefaultInitializer
    {
        #region [       Initialization       ]

        //===========================================================================
        /// <summary>
        /// Initializes the properties of a new <c>XPlorerBar</c> created in the 
        /// designer.
        /// </summary>
        /// <param name="item">The item to initialize. This should not be a
        /// <c>null</c> reference (<c>Nothing</c> in Visual Basic).</param>
        //===========================================================================
        public override void InitializeDefaults(ModelItem item)
        {
            //Opens edit mode
            using (ModelEditingScope batchedChange = item.BeginEdit("Creates an XPlorerBar"))
            {
                //Clears 'Height' and 'Width' values of the new XPlorerBar
                item.Properties["Width"].ClearValue();
                item.Properties["Height"].ClearValue();

                //Adds a new XPlorerSection to the new XPlorerBar
                XPlorerSection newSection = new XPlorerSection();
                item.Properties["Items"].Collection.Add(newSection);

                //Commits all changes made in edit mode
                batchedChange.Complete();
            }
        }

        #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.

License

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


Written By
Team Leader
France France
I have been developing and managing projects for real-time embedded softwares for eight years. Then, I moved from Paris to the south of France and began to lead a team who was developping Java applications.

My main occupation right now is to continue my journey in the WPF world.

You can check out my blog here. [^]

Comments and Discussions