/// <summary>
/// This command displays the "Sheet Set Viewer" palette.
/// </summary>
[Rtm.CommandMethod(ns, "ss-viewer", Rtm.CommandFlags.Session)]
public void OpenSheetSetViewer() {
// Create the new palette set
Win.PaletteSet palette_set = new Win.PaletteSet(
"Sheet Set Viewer");
ElementHost host = new ElementHost();
host.AutoSize = true;
host.Dock = DockStyle.Fill;
// Host my WPF control
SheetSetViewer control = new SheetSetViewer();
// Save the link to the custom control
control.tree.Tag = control;
control.props.Tag = control;
host.Child = control;
// Create the new tab in the palette set
Win.Palette palette = palette_set.Add("Sheet set's tree", host);
GetOpenedSheetSets(control); // Fill the combo box (sheet sets list)
// Update the info, when other sheet set was selected from the combo box.
control.cboSheetSets.SelectionChanged += new WPF.SelectionChangedEventHandler(
cboSheetSets_SelectionChanged);
// Update the property's info, when other item was selected in the sheet set tree.
control.tree.SelectedItemChanged += new System.Windows
.RoutedPropertyChangedEventHandler<object>(tree_SelectedItemChanged);
palette_set.Style = Win.PaletteSetStyles.ShowCloseButton |
Win.PaletteSetStyles.ShowPropertiesMenu |
Win.PaletteSetStyles.ShowAutoHideButton;
palette_set.Size = new Size(400, 600);
// Position of top left corner of palette
palette_set.Location = new Point(400, 400);
// Let the palette set can be docked only to left\right by the user
palette_set.DockEnabled = Win.DockSides.Left | Win.DockSides.Right;
// Uncheck the "Allow Docking" (as I expect).
palette_set.Dock = Win.DockSides.None;
// Display the palette set
palette_set.KeepFocus = true;
palette_set.Visible = true;
}