Custom selection extension
ToggleDockWinBtn.cs
// Copyright 2010 ESRI
// 
// All rights reserved under the copyright laws of the United States
// and applicable international laws, treaties, and conventions.
// 
// You may freely redistribute and use this sample code, with or
// without modification, provided you include the original copyright
// notice and use restrictions.
// 
// See the use restrictions.
// 

using System;
using System.Collections.Generic;
using System.Text;
using System.IO;
using ESRI.ArcGIS.esriSystem;
using ESRI.ArcGIS.Framework;

namespace SelectionSample
{
  public class ToggleDockWinBtn : ESRI.ArcGIS.Desktop.AddIns.Button
  {
    public ToggleDockWinBtn()
    {
     
    }

    protected override void OnClick()
    {
      IDockableWindow dockWindow = SelectionExtension.GetSelectionCountWindow();

      if (dockWindow == null)
        return;
      
      dockWindow.Show(!dockWindow.IsVisible());
    }

    protected override void OnUpdate()
    {
      this.Enabled = SelectionExtension.IsExtensionEnabled();
    }
  }

}