You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Within my ToolViewModel, how do I know if the tool is docked as a Document? Or if it is floating for example?
I made a tweak in the LayoutInitializer. I've changed PaneLocation enum, adding Floating and Document options:
public void AfterInsertAnchorable(LayoutRoot layout, LayoutAnchorable anchorableShown)
{
// If this is the first anchorable added to this pane, then use the preferred size.
var tool = anchorableShown.Content as ITool;
if (tool != null)
{
var anchorablePane = anchorableShown.Parent as LayoutAnchorablePane;
if (anchorablePane != null && anchorablePane.ChildrenCount == 1)
{
switch (tool.PreferredLocation)
{
case PaneLocation.Left:
case PaneLocation.Right:
anchorablePane.DockWidth = new GridLength(tool.PreferredWidth, GridUnitType.Pixel);
break;
case PaneLocation.Bottom:
anchorablePane.DockHeight = new GridLength(tool.PreferredHeight, GridUnitType.Pixel);
break;
case PaneLocation.Floating:
{
anchorableShown.FloatingHeight = tool.PreferredHeight;
anchorableShown.FloatingWidth = tool.PreferredWidth;
var window = Application.Current.MainWindow;
var screen = System.Windows.Forms.Screen.FromHandle(new WindowInteropHelper(window).Handle);
anchorableShown.FloatingTop = (screen.WorkingArea.Height / 2d) - (anchorableShown.FloatingHeight / 2d);
anchorableShown.FloatingLeft = (screen.WorkingArea.Width / 2d) - (anchorableShown.FloatingWidth / 2d);
anchorableShown.Float();
break;
}
case PaneLocation.Document:
anchorableShown.DockAsDocument();
break;
default:
throw new ArgumentOutOfRangeException();
}
}
}
}
However, MVVM in Avalon is fairly difficult, so I couldn't figure it out how to find out whether my ToolViewModel is docked as document.
Any insights?
The text was updated successfully, but these errors were encountered:
Within my ToolViewModel, how do I know if the tool is docked as a Document? Or if it is floating for example?
I made a tweak in the
LayoutInitializer
. I've changedPaneLocation
enum, addingFloating
andDocument
options:However, MVVM in Avalon is fairly difficult, so I couldn't figure it out how to find out whether my ToolViewModel is docked as document.
Any insights?
The text was updated successfully, but these errors were encountered: