I am trying to recreate the example from examples\WPFDemo\ however, I am having a couple of issues.
1) When the toolbox is closed, it is throwing an exception ('System.ComponentModel.Win32Exception' in WindowsBase.dll)..The exception seems to be handled , though it is displayed in my visual studio's immediate window. While the exception is not causing a hard error, it is causing the toolbox to run poorly in debug mode and I doubt that is an expected behavior. Every time the toolbox is reopened and closed, the exception is compounded further..
Additionally, after the first exception appears, it seems to infect every toolbox and it will appear anytime another toolbox is brought into focus.
2) The drag symbol on the left side of the toolbar that appears when a toolbox is docked is not showing.. It seems the usercontrol is sitting ontop of it regardless of any margins or alignment applied.
Any thoughts on these issues would be appreciated.
Thanks!
public class MsToolbox : DockableToolbar, IGuiDockable { public MsToolbox(UserControl toolboxUserControl) { Content = toolboxUserControl; Title = "Test"; AttachingToHost += OnAttachingToHost; DetachingFromHost += OnDetachingFromHost; Attach(TopoCloudClient.Addin, "Testing"); } private void OnDetachingFromHost(object sender, EventArgs e) { Debug.Print("Detaching"); } private void OnAttachingToHost(object sender, AttachingToHostEventArgs e) { e.AttachPoint = new Point(0, 0); Debug.Print("Attaching"); } protected override void OnClosed(EventArgs e) { base.OnClosed(e); Detach(); Dispose(); } #region IGuiDockable Members private Size _rejectedSize = Size.Empty; public bool GetDockedExtent (GuiDockPosition dockPosition, ref GuiDockExtent extentFlag, ref Size dockExtent) { dockExtent.Height = CommonDockSize.Height; if (dockPosition == GuiDockPosition.Top || dockPosition == GuiDockPosition.Bottom) { dockExtent.Width = (int) ActualWidth + 25; extentFlag = GuiDockExtent.Specified; } else if (dockPosition == GuiDockPosition.NotDocked) extentFlag = GuiDockExtent.Specified; else extentFlag = GuiDockExtent.InvalidRegion; return true; } public bool WindowMoving (WindowMovingCorner corners, ref Size newSize) { newSize.Height = CommonDockSize.Height; if (corners != WindowMovingCorner.LowerRight || _rejectedSize.Equals (newSize)) { _rejectedSize = newSize; newSize.Width = (int) ActualWidth; } return true; } #endregion }
<UserControl x:Class="TopoCloud_Client.Windows.TopoDOT.Toolboxes.Point_Cloud_Snap_Mode.PointCloudSnapModeWindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:userControls="clr-namespace:TopoCloud_Client.Common.User_Controls" xmlns:viewModels="clr-namespace:TopoCloud_Client.Windows.TopoDOT.Toolboxes.Point_Cloud_Snap_Mode.View_Models" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" mc:Ignorable="d" d:DesignHeight="24"> <UserControl.DataContext> <viewModels:PointCloudSnapModeViewModel/> </UserControl.DataContext> <StackPanel Orientation="Horizontal" > <CheckBox Margin="0,0,12,0" VerticalAlignment="Center">CheckBox in Toolbar</CheckBox> <Button VerticalAlignment="Center" MinHeight="24" Padding="3">Button in Toolbar</Button> </StackPanel> </UserControl>
public static void OpenToolbox(this UserControl userControl) { var toolBox = new MsToolbox(userControl); toolBox.Show(); }
I tested wpfdemo example with keyin wpfdemo open5 and wpfdemo close5. It works well. Can you compare your code with Window5.cs and try to find the tiny difference?
Hi Yongan,
if I attach the visual studio debugger to MicroStation when using wpfdemo, I am seeing the same exceptions appear in the debuggers immediate window
The wpfdemo also has the same problem with the Drag symbol on the left side of the toolbar not showing when the toolbar is docked.. I can get the drag symbol to appear if I use the keyin "ribbon rebuild", but then if I undock and dock it again, it disappears
I will also add that the contents of the toolbar seem to disappear when dragging the toolbox around the docking area.
See this animated gif: https://imgur.com/a/ty8ywKW