When I was trying to play how to use WPF to create a toolbox with VS 2015 Tools for MicroStation CONNECT Edition , I found that I couldn't fix or change the Window size. Glad if someone could provide the comment as following:
- ResizeMode, WindowStyle cannot help fix the toolbox
- Toolbar_SizeChanged cannot help resize the toolbox
namespace MSAddinSample
{
public partial class Toolbox : UserControl
{
private static Bentley.MstnPlatformNET.WPF.DockableToolbar currentControl;
private static Bentley.ResourceManagement.IMatchLifetime BRI;
private Bentley.MstnPlatformNET.AddIn m_addIn;
public Toolbox(Bentley.MstnPlatformNET.AddIn addIn)
{
m_addIn = addIn;
InitializeComponent();
}
internal static void ShowWindow(Bentley.MstnPlatformNET.AddIn addIn)
{
if (null != currentControl)
{
currentControl.Focus();
return;
}
currentControl = new Bentley.MstnPlatformNET.WPF.DockableToolbar();
currentControl.ResizeMode = System.Windows.ResizeMode.NoResize;
currentControl.WindowStyle = System.Windows.WindowStyle.ToolWindow;
currentControl.Content = new Toolbox(addIn);
currentControl.Attach(BRI, 'control');
currentControl.Show();
//currentControl.WindowContent.CanDockVertically = false;
}
private void Toolbox_Unloaded(object sender, System.Windows.RoutedEventArgs e)
{
currentControl = null;
}
private void Toolbar_SizeChanged(object sender, System.Windows.SizeChangedEventArgs e)
{
currentControl.Width = 200;
currentControl.Height = 30;
}
}