本文整理汇总了C#中Xceed.Wpf.AvalonDock.Layout.LayoutAnchorable类的典型用法代码示例。如果您正苦于以下问题:C# LayoutAnchorable类的具体用法?C# LayoutAnchorable怎么用?C# LayoutAnchorable使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
LayoutAnchorable类属于Xceed.Wpf.AvalonDock.Layout命名空间,在下文中一共展示了LayoutAnchorable类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: AfterInsertAnchorable
public void AfterInsertAnchorable(LayoutRoot layout, LayoutAnchorable anchorableShown)
{
var content = anchorableShown.Content as PaneViewModel;
if(content != null && content.DoFloating)
{
anchorableShown.Float();
}
}
示例2: Attach
internal override void Attach(LayoutContent model)
{
_anchorable = model as LayoutAnchorable;
_anchorable.IsVisibleChanged += new EventHandler(_anchorable_IsVisibleChanged);
base.Attach(model);
}
示例3: BeforeInsertAnchorable
public bool BeforeInsertAnchorable(LayoutRoot layout, LayoutAnchorable anchorableToShow, ILayoutContainer destinationContainer)
{
var tool = anchorableToShow.Content as ITool;
if (tool != null)
{
var preferredLocation = tool.PreferredLocation;
string paneName = GetPaneName(preferredLocation);
var toolsPane = layout.Descendents().OfType<LayoutAnchorablePane>().FirstOrDefault(d => d.Name == paneName);
if (toolsPane == null)
{
switch (preferredLocation)
{
case PaneLocation.Left:
toolsPane = CreateAnchorablePane(layout, Orientation.Horizontal, paneName, InsertPosition.Start);
break;
case PaneLocation.Right:
toolsPane = CreateAnchorablePane(layout, Orientation.Horizontal, paneName, InsertPosition.End);
break;
case PaneLocation.Bottom:
toolsPane = CreateAnchorablePane(layout, Orientation.Vertical, paneName, InsertPosition.End);
break;
default:
throw new ArgumentOutOfRangeException();
}
}
toolsPane.Children.Add(anchorableToShow);
return true;
}
return false;
}
示例4: BeforeInsertAnchorable
public bool BeforeInsertAnchorable(LayoutRoot layout, LayoutAnchorable anchorableToShow, ILayoutContainer destinationContainer)
{
if (destinationContainer != null &&
destinationContainer.FindParent<LayoutFloatingWindow>() != null)
{
return false;
}
foreach (var viewModelPane in ViewModelPanes)
{
if (viewModelPane.Item1.IsInstanceOfType(anchorableToShow.Content))
{
var pane = layout
.Descendents()
.OfType<LayoutAnchorablePane>()
.SingleOrDefault(p => p.Name == viewModelPane.Item2);
if (pane != null)
{
pane.Children.Add(anchorableToShow);
if (viewModelPane.Item3)
{
anchorableToShow.ToggleAutoHide();
}
return true;
}
}
}
return false;
}
示例5: BeforeInsertAnchorable
public bool BeforeInsertAnchorable(LayoutRoot layout, LayoutAnchorable anchorableToShow, ILayoutContainer destinationContainer)
{
//Determine panel name for given view model type
string destPaneName = string.Empty;
if (anchorableToShow.Content is JadeControls.Workspace.ViewModel.WorkspaceViewModel ||
anchorableToShow.Content is JadeControls.SymbolInspector.SymbolInspectorPaneViewModel ||
anchorableToShow.Content is JadeControls.CursorInspector.CursorInspectorPaneViewModel)
{
destPaneName = "LeftToolPanel";
}
else if (anchorableToShow.Content is JadeControls.OutputControl.ViewModel.OutputViewModel ||
anchorableToShow.Content is JadeControls.SearchResultsControl.ViewModel.SearchResultsPaneViewModel)
{
destPaneName = "LowerToolPanel";
}
else if (anchorableToShow.Content is JadeControls.ContextTool.ContextPaneViewModel)
{
destPaneName = "RightToolPanel";
}
else
{
return false;
}
//Find pane
var toolsPane = layout.Descendents().OfType<LayoutAnchorablePane>().FirstOrDefault(d => d.Name == destPaneName);
if (toolsPane != null)
{
//Add
toolsPane.Children.Add(anchorableToShow);
return true;
}
return false;
}
示例6: AddPanel
public void AddPanel(LayoutAnchorable panel)
{
if (!_Panels.Contains(panel))
{
_Panels.Add(panel);
}
}
示例7: LayoutAnchorControl
internal LayoutAnchorControl(LayoutAnchorable model)
{
_model = model;
_model.IsActiveChanged += new EventHandler(_model_IsActiveChanged);
_model.IsSelectedChanged += new EventHandler(_model_IsSelectedChanged);
SetSide(_model.FindParent<LayoutAnchorSide>().Side);
}
示例8: addToAnchorablePane
/// <summary>
/// Method that adds to the GraphicsContainer a LayoutAnchorable that contains a Data visualizer user control
/// </summary>
/// <param name="objectToAdd"></param>
public void addToAnchorablePane(UserControl objectToAdd, string Title)
{
LayoutAnchorable doc = new LayoutAnchorable();
doc.Hiding += doc_Hiding;
doc.CanHide = true;
doc.CanClose = true;
doc.Title = Title;
doc.Content = objectToAdd;
doc.AddToLayout(containersManager, AnchorableShowStrategy.Right);
}
示例9: BeforeInsertAnchorable
//http://avalondock.codeplex.com/wikipage?title=AvalonDock%202.0%20Getting%20Start%20Guide&referringTitle=Documentation
public bool BeforeInsertAnchorable(LayoutRoot layout, LayoutAnchorable anchorableToShow, ILayoutContainer destinationContainer)
{
if (anchorableToShow.Content is ITool)
{
var preferredLocation = ((ITool) anchorableToShow.Content).PreferredLocation;
string paneName = GetPaneName(preferredLocation);
var toolsPane = layout.Descendents().OfType<LayoutAnchorablePane>().FirstOrDefault(d => d.Name == paneName);
if (toolsPane == null)
{
switch (preferredLocation)
{
case PaneLocation.Left:
{
//TODO: this should use two steps: first, try to add to existing "LayoutAnchorablePane" if not create layoutAnchorGroup like below
var layoutAnchorSide = layout.Descendents().OfType<LayoutAnchorSide>().First(side => side.Side == AnchorSide.Left);
var layoutAnchorGroup = new LayoutAnchorGroup();
layoutAnchorGroup.InsertChildAt(0, anchorableToShow);
layoutAnchorSide.InsertChildAt(0, layoutAnchorGroup);
anchorableToShow.AutoHideWidth = 200;
//var parent = layout.Descendents().OfType<LayoutPanel>().First(d => d.Orientation == Orientation.Horizontal);
//toolsPane = new LayoutAnchorablePane { DockWidth = new GridLength(200, GridUnitType.Pixel) };
}
break;
case PaneLocation.Right:
{
var parent = layout.Descendents().OfType<LayoutPanel>().First(d => d.Orientation == Orientation.Horizontal);
toolsPane = new LayoutAnchorablePane { DockWidth = new GridLength(200, GridUnitType.Pixel) };
parent.Children.Add(toolsPane);
}
break;
case PaneLocation.Bottom:
{
var ds = layout.Descendents().ToList();
var items = layout.Descendents().OfType<LayoutPanel>().ToList();
var items2 = layout.Descendents().OfType<LayoutAnchorGroup>().ToList();
//var parent = items2.First();
var parent = layout.Descendents().OfType<LayoutPanel>().First(d => d.Orientation == Orientation.Vertical);
toolsPane = new LayoutAnchorablePane { DockHeight = new GridLength(300, GridUnitType.Pixel) };
parent.Children.Add(toolsPane);
}
break;
default:
throw new ArgumentOutOfRangeException();
}
}
if(toolsPane != null)
toolsPane.Children.Add(anchorableToShow);
return true;
}
return false;
}
示例10: Button_Click
private void Button_Click(object sender, RoutedEventArgs e)
{
IDockingViewManager dockingViewManager = _container.Resolve<DockingViewManager>(); // ServiceLocator.Current.GetInstance<DockingViewManager>();
string viewType = (sender as Button).Content as string;
UserControl view = new UserControl();
if (viewType == "Dur") view = dockingViewManager.GetDockingView(WellknowViewName.DurationTraderView);
if (viewType == "5-10YR") view = dockingViewManager.GetDockingView(WellknowViewName._5_10Yr);
LayoutAnchorable a1 = new LayoutAnchorable() {Content=view, Title="Floating", FloatingWidth = 600, FloatingHeight = 400, FloatingLeft=50, FloatingTop=50 };
a1.AddToLayout(dockingManager, AnchorableShowStrategy.Most);
a1.Float();
}
示例11: AddDocWpf
/// <summary>
/// 加入新的Window到文档口(WPF Only)
/// </summary>
/// <param name="wd">WPF窗口</param>
/// <param name="title">标题</param>
public void AddDocWpf(Object wd, String title)
{
var docPane = _dManager.Layout.Descendents().OfType<LayoutDocumentPane>().First();
var doc = new LayoutAnchorable
{
Title = title,
Content = wd,
IsSelected = true,
CanAutoHide = true
};
if (docPane != null) docPane.Children.Add(doc);
}
示例12: AddDocForm
/// <summary>
/// 加入新的WinForm到文档口(WPF Only)
/// </summary>
public void AddDocForm(UserControl uc, String title)
{
var docPane = _dManager.Layout.Descendents().OfType<LayoutDocumentPane>().First();
var doc = new LayoutAnchorable
{
Title = title,
Content = new WindowsFormsHost { Child = uc },
IsSelected = true,
CanAutoHide = true
};
docPane.Children.Add(doc);
}
示例13: BeforeInsertAnchorable
public bool BeforeInsertAnchorable(LayoutRoot layout, LayoutAnchorable anchorableToShow, ILayoutContainer destinationContainer)
{
if (destinationContainer != null &&
destinationContainer.FindParent<LayoutFloatingWindow>() != null)
return false;
var toolsPane = layout.Descendents().OfType<LayoutAnchorablePane>().FirstOrDefault(d => d.Name == "ToolsPane");
if (toolsPane != null)
{
toolsPane.Children.Add(anchorableToShow);
return true;
}
return false;
}
示例14: BeforeInsertAnchorable
public bool BeforeInsertAnchorable(LayoutRoot layout, LayoutAnchorable anchorable, ILayoutContainer destination)
{
LayoutAnchorablePane pane = destination as LayoutAnchorablePane;
if (destination != null && destination.FindParent<LayoutFloatingWindow>() != null)
{
return false;
}
LayoutAnchorablePane files = layout.Descendents().OfType<LayoutAnchorablePane>().FirstOrDefault(d => d.Name == "pnFiles");
if (files != null)
{
files.Children.Add(anchorable);
return true;
}
return false;
}
示例15: BeforeInsertAnchorable
public bool BeforeInsertAnchorable(LayoutRoot layout, LayoutAnchorable anchorableToShow, ILayoutContainer destinationContainer)
{
var myViewModel = anchorableToShow.Content as IToolWindow;
if (myViewModel != null)
{
var lap = layout.Descendents();
var pane = lap.OfType<LayoutAnchorablePane>().FirstOrDefault(d => d.Name == myViewModel.DefaultDockingPane);
if (pane != null)
{
pane.Children.Add(anchorableToShow);
return true;
}
}
return false;
}