Click here to Skip to main content
Click here to Skip to main content
Add your own
alternative version
Go to top

Building a Docking Window Management Solution in WPF

, 1 Jan 2011
A docking window solution using WPF as part of Synergy toolkit
Synergy.zip
MixModes.Synergy.Resources
bin
Debug
MixModes.Synergy.Resources.dll
MixModes.Synergy.Resources.pdb
MixModes.Synergy.Resources.csproj.user
MixModes.Synergy.Resources.csproj.vspscc
MixModes.Synergy.Resources.vsdoc
obj
Debug
DesignTimeResolveAssemblyReferencesInput.cache
GenerateResource-ResGen.read.1.tlog
GenerateResource-ResGen.write.1.tlog
GenerateResource.read.1.tlog
MixModes.Synergy.Resources.dll
MixModes.Synergy.Resources.g.resources
MixModes.Synergy.Resources.pdb
MixModes.Synergy.Resources.Resources.Language.resources
TempPE
Properties
Resources
Close.png
DockBottom.png
DockCenter.png
DockHexagon.png
DockLeft.png
DockRight.png
DockTop.png
Error.png
Maximize.png
Minimize.png
NewProject.png
Restore.png
SplitBottom.png
SplitLeft.PNG
SplitRight.png
SplitTop.png
MixModes.Synergy.Themes
bin
Debug
MixModes.Synergy.Resources.dll
MixModes.Synergy.Resources.pdb
MixModes.Synergy.Themes.dll
MixModes.Synergy.Themes.pdb
MixModes.Synergy.Themes.csproj.vspscc
MixModes.Synergy.Themes.vsdoc
obj
Debug
Aero.NormalColor.baml
Brushes.baml
Buttons.baml
DesignTimeResolveAssemblyReferencesInput.cache
DockPane.baml
GenerateResource-ResGen.read.1.tlog
GenerateResource-ResGen.write.1.tlog
Images.baml
MixModes.Synergy.Themes.dll
MixModes.Synergy.Themes.g.resources
MixModes.Synergy.Themes.pdb
MixModes.Synergy.Themes.Properties.Resources.resources
MixModes.Synergy.Themes_MarkupCompile.cache
ResizableAdorner.baml
ResolveAssemblyReference.cache
TabItems.baml
TempPE
Text.baml
Themes.baml
ToolTips.baml
WindowParts.baml
Windows.baml
Properties
Settings.settings
MixModes.Synergy.Utilities
bin
Debug
MixModes.Synergy.Utilities.dll
MixModes.Synergy.Utilities.pdb
MixModes.Synergy.Utilities.csproj.vspscc
MixModes.Synergy.Utilities.vsdoc
obj
Debug
DesignTimeResolveAssemblyReferencesInput.cache
MixModes.Synergy.Utilities.dll
MixModes.Synergy.Utilities.pdb
TempPE
Properties
MixModes.Synergy.VisualFramework
Adorners
Behaviors
bin
Debug
de
Microsoft.Expression.Interactions.resources.dll
System.Windows.Interactivity.resources.dll
en
Microsoft.Expression.Interactions.resources.dll
System.Windows.Interactivity.resources.dll
es
Microsoft.Expression.Interactions.resources.dll
System.Windows.Interactivity.resources.dll
fr
Microsoft.Expression.Interactions.resources.dll
System.Windows.Interactivity.resources.dll
it
Microsoft.Expression.Interactions.resources.dll
System.Windows.Interactivity.resources.dll
ja
Microsoft.Expression.Interactions.resources.dll
System.Windows.Interactivity.resources.dll
ko
Microsoft.Expression.Interactions.resources.dll
System.Windows.Interactivity.resources.dll
Microsoft.Expression.Interactions.dll
MixModes.Synergy.Resources.dll
MixModes.Synergy.Resources.pdb
MixModes.Synergy.Themes.dll
MixModes.Synergy.Themes.pdb
MixModes.Synergy.Utilities.dll
MixModes.Synergy.Utilities.pdb
MixModes.Synergy.VisualFramework.dll
MixModes.Synergy.VisualFramework.pdb
System.Windows.Interactivity.dll
WPFToolkit.dll
WPFToolkit.pdb
zh-Hans
Microsoft.Expression.Interactions.resources.dll
System.Windows.Interactivity.resources.dll
zh-Hant
Microsoft.Expression.Interactions.resources.dll
System.Windows.Interactivity.resources.dll
Commands
Controls
Converters
Extensions
Framework
MixModes.Synergy.VisualFramework.csproj.user
MixModes.Synergy.VisualFramework.csproj.vspscc
MixModes.Synergy.VisualFramework.vsdoc
obj
Debug
Controls
NotificationToolTipContent.baml
DesignTimeResolveAssemblyReferencesInput.cache
MixModes.Synergy.VisualFramework.dll
MixModes.Synergy.VisualFramework.g.resources
MixModes.Synergy.VisualFramework.pdb
MixModes.Synergy.VisualFramework_MarkupCompile.cache
MixModes.Synergy.VisualFramework_MarkupCompile.lref
ResolveAssemblyReference.cache
TempPE
Themes
Generic.baml
Windows
WindowsManager.baml
Properties
Themes
ViewModels
Views
Windows
Synegy
bin
Debug
de
System.Windows.Interactivity.resources.dll
en
System.Windows.Interactivity.resources.dll
es
System.Windows.Interactivity.resources.dll
fr
System.Windows.Interactivity.resources.dll
it
System.Windows.Interactivity.resources.dll
ja
System.Windows.Interactivity.resources.dll
ko
System.Windows.Interactivity.resources.dll
MixModes.Synergy.Resources.dll
MixModes.Synergy.Resources.pdb
MixModes.Synergy.Themes.dll
MixModes.Synergy.Themes.pdb
MixModes.Synergy.Utilities.dll
MixModes.Synergy.Utilities.pdb
MixModes.Synergy.VisualFramework.dll
MixModes.Synergy.VisualFramework.pdb
Synegy.exe
Synegy.pdb
Synegy.vshost.exe
Synegy.vshost.exe.manifest
System.Windows.Interactivity.dll
zh-Hans
System.Windows.Interactivity.resources.dll
zh-Hant
System.Windows.Interactivity.resources.dll
obj
x86
Debug
App.baml
DesignTimeResolveAssemblyReferencesInput.cache
GenerateResource-ResGen.read.1.tlog
GenerateResource-ResGen.write.1.tlog
MainWindow.baml
ResolveAssemblyReference.cache
Resources
MainWindowMenus.baml
Synegy.exe
Synegy.g.resources
Synegy.pdb
Synegy.Properties.Resources.resources
Synegy_MarkupCompile.cache
TempPE
Views
NewProjectWindow.baml
Properties
Settings.settings
Resources
SplashScreen.jpg
Synegy.csproj.user
Synegy.csproj.vspscc
Synegy.vsdoc
Views
///
/// Copyright(C) MixModes Inc. 2010
/// 

using System.Windows.Data;
using System;
using System.Globalization;
using System.Windows.Controls;
using System.Windows;
namespace MixModes.Synergy.VisualFramework.Converters
{
    /// <summary>
    /// Converts empty behavior of a panel to visibility
    /// </summary>
    public class EmptyPanelToVisibilityConverter : IValueConverter
    {
        /// <summary>
        /// Initializes a new instance of the <see cref="EmptyPanelToVisibilityConverter"/> class.
        /// </summary>
        public EmptyPanelToVisibilityConverter()
        {
            EmptyVisibility = Visibility.Collapsed;    
        }

        /// <summary>
        /// Empty visibility mode
        /// </summary>
        public Visibility EmptyVisibility
        {
            get;
            set;
        }

        /// <summary>
        /// Converts a value.
        /// </summary>
        /// <param name="value">The value produced by the binding source.</param>
        /// <param name="targetType">The type of the binding target property.</param>
        /// <param name="parameter">The converter parameter to use.</param>
        /// <param name="culture">The culture to use in the converter.</param>
        /// <returns>
        /// A converted value. If the method returns null, the valid null value is used.
        /// </returns>
        public object Convert(object value,
                              Type targetType, 
                              object parameter, 
                              CultureInfo culture)
        {
            Panel panel;
            if ((value == null) || ((panel = value as Panel) == null))
            {
                return EmptyVisibility;
            }

            return panel.Children.Count > 0 ? Visibility.Visible : EmptyVisibility;
        }

        /// <summary>
        /// Converts a value.
        /// </summary>
        /// <param name="value">The value that is produced by the binding target.</param>
        /// <param name="targetType">The type to convert to.</param>
        /// <param name="parameter">The converter parameter to use.</param>
        /// <param name="culture">The culture to use in the converter.</param>
        /// <returns>
        /// A converted value. If the method returns null, the valid null value is used.
        /// </returns>
        public object ConvertBack(object value, 
                                  Type targetType, 
                                  object parameter, 
                                  CultureInfo culture)
        {
            throw new InvalidOperationException();
        }
    }
}

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)

Share

About the Author

Ashish Kaila
Software Developer (Senior) MixModes Inc. | Research In Motion
Canada Canada
Ashish worked for Microsoft for a number of years in Microsoft Visual Studio (Architect edition) and Windows Live division as a developer. Before that he was a developer consultant mainly involved in distributed service development / architecture. His main interests are distributed software architecture, patterns and practices and mobile device development.
 
Currently Ashish serves as a Technical Lead at RIM leading next generation BlackBerry media experience and also runs his own company MixModes Inc. specializing in .NET / WPF / Silverlight technologies. You can visit MixModes at http://mixmodes.com or follow it on Twitter @MixModes
 
In his free time he is an avid painter, hockey player and enjoys travelling. His blog is at: http://ashishkaila.serveblog.net
Follow on   Twitter

| Advertise | Privacy | Mobile
Web04 | 2.8.140926.1 | Last Updated 1 Jan 2011
Article Copyright 2010 by Ashish Kaila
Everything else Copyright © CodeProject, 1999-2014
Terms of Service
Layout: fixed | fluid