本文整理汇总了C#中LayoutContent类的典型用法代码示例。如果您正苦于以下问题:C# LayoutContent类的具体用法?C# LayoutContent怎么用?C# LayoutContent使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
LayoutContent类属于命名空间,在下文中一共展示了LayoutContent类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Attach
internal override void Attach(LayoutContent model)
{
_anchorable = model as LayoutAnchorable;
_anchorable.IsVisibleChanged += new EventHandler(_anchorable_IsVisibleChanged);
base.Attach(model);
}
示例2: Attach
internal virtual void Attach(LayoutContent model)
{
LayoutElement = model;
Model = model.Content;
InitDefaultCommands();
LayoutElement.IsSelectedChanged+=new EventHandler(LayoutElement_IsSelectedChanged);
LayoutElement.IsActiveChanged+=new EventHandler(LayoutElement_IsActiveChanged);
DataContext = this;
}
示例3: Attach
internal virtual void Attach(LayoutContent model)
{
LayoutElement = model;
Model = model.Content;
InitDefaultCommands();
LayoutElement.IsSelectedChanged += LayoutElement_IsSelectedChanged;
LayoutElement.IsActiveChanged += LayoutElement_IsActiveChanged;
DataContext = this;
Trace.WriteLine(string.Format("Attach({0})", LayoutElement.Title));
}
示例4: Attach
internal virtual void Attach(LayoutContent model)
{
LayoutElement = model;
Model = model.Content;
InitDefaultCommands();
LayoutElement.IsSelectedChanged += new EventHandler(LayoutElement_IsSelectedChanged);
LayoutElement.IsActiveChanged += new EventHandler(LayoutElement_IsActiveChanged);
DataContext = this;
System.Diagnostics.Trace.WriteLine(string.Format("Attach({0})", LayoutElement.Title));
}
示例5: BeforeInsertContent
private bool BeforeInsertContent(LayoutRoot layout, LayoutContent anchorableToShow)
{
var viewModel = (ViewModelBase) anchorableToShow.Content;
var layoutContent =
layout.Descendents().OfType<LayoutContent>().FirstOrDefault(x => x.ContentId == viewModel.ContextId);
if (layoutContent == null)
return false;
layoutContent.Content = anchorableToShow.Content;
// Add layoutContent to it's previous container
var layoutContainer =
layoutContent.GetType()
.GetProperty("PreviousContainer", BindingFlags.NonPublic | BindingFlags.Instance)
.GetValue(layoutContent, null) as ILayoutContainer;
if (layoutContainer is LayoutAnchorablePane)
(layoutContainer as LayoutAnchorablePane).Children.Add(layoutContent as LayoutAnchorable);
else if (layoutContainer is LayoutDocumentPane)
(layoutContainer as LayoutDocumentPane).Children.Add(layoutContent);
else
throw new NotSupportedException();
return true;
}
示例6: _ExecuteContentActivateCommand
internal void _ExecuteContentActivateCommand(LayoutContent content)
{
content.IsActive = true;
}
示例7: _ExecuteCloseAllButThisCommand
internal void _ExecuteCloseAllButThisCommand(LayoutContent contentSelected)
{
foreach (var contentToClose in Layout.Descendents().OfType<LayoutContent>().Where(d => d != contentSelected && (d.Parent is LayoutDocumentPane || d.Parent is LayoutDocumentFloatingWindow)).ToArray())
{
if (!contentToClose.CanClose)
continue;
var layoutItem = GetLayoutItemFromModel(contentToClose);
if (layoutItem.CloseCommand != null)
{
if (layoutItem.CloseCommand.CanExecute(null))
layoutItem.CloseCommand.Execute(null);
}
else
{
if (contentToClose is LayoutDocument)
_ExecuteCloseCommand(contentToClose as LayoutDocument);
else if (contentToClose is LayoutAnchorable)
_ExecuteCloseCommand(contentToClose as LayoutAnchorable);
}
}
}
示例8: StartDraggingFloatingWindowForContent
internal void StartDraggingFloatingWindowForContent(LayoutContent contentModel, bool startDrag = true)
{
if (!contentModel.CanFloat)
return;
var contentModelAsAnchorable = contentModel as LayoutAnchorable;
if (contentModelAsAnchorable != null &&
contentModelAsAnchorable.IsAutoHidden)
contentModelAsAnchorable.ToggleAutoHide();
var parentPane = contentModel.Parent as ILayoutPane;
var parentPaneAsPositionableElement = contentModel.Parent as ILayoutPositionableElement;
var parentPaneAsWithActualSize = contentModel.Parent as ILayoutPositionableElementWithActualSize;
var contentModelParentChildrenIndex = parentPane.Children.ToList().IndexOf(contentModel);
if (contentModel.FindParent<LayoutFloatingWindow>() == null)
{
((ILayoutPreviousContainer)contentModel).PreviousContainer = parentPane;
contentModel.PreviousContainerIndex = contentModelParentChildrenIndex;
}
parentPane.RemoveChildAt(contentModelParentChildrenIndex);
double fwWidth = contentModel.FloatingWidth;
double fwHeight = contentModel.FloatingHeight;
if (fwWidth == 0.0)
fwWidth = parentPaneAsPositionableElement.FloatingWidth;
if (fwHeight == 0.0)
fwHeight = parentPaneAsPositionableElement.FloatingHeight;
if (fwWidth == 0.0)
fwWidth = parentPaneAsWithActualSize.ActualWidth;
if (fwHeight == 0.0)
fwHeight = parentPaneAsWithActualSize.ActualHeight;
LayoutFloatingWindow fw;
LayoutFloatingWindowControl fwc;
if (contentModel is LayoutAnchorable)
{
var anchorableContent = contentModel as LayoutAnchorable;
fw = new LayoutAnchorableFloatingWindow()
{
RootPanel = new LayoutAnchorablePaneGroup(
new LayoutAnchorablePane(anchorableContent)
{
DockWidth = parentPaneAsPositionableElement.DockWidth,
DockHeight = parentPaneAsPositionableElement.DockHeight,
DockMinHeight = parentPaneAsPositionableElement.DockMinHeight,
DockMinWidth = parentPaneAsPositionableElement.DockMinWidth,
FloatingLeft = parentPaneAsPositionableElement.FloatingLeft,
FloatingTop = parentPaneAsPositionableElement.FloatingTop,
FloatingWidth = parentPaneAsPositionableElement.FloatingWidth,
FloatingHeight = parentPaneAsPositionableElement.FloatingHeight,
})
};
Layout.FloatingWindows.Add(fw);
fwc = new LayoutAnchorableFloatingWindowControl(
fw as LayoutAnchorableFloatingWindow)
{
Width = fwWidth,
Height = fwHeight,
Left = contentModel.FloatingLeft,
Top = contentModel.FloatingTop
};
}
else
{
var anchorableDocument = contentModel as LayoutDocument;
fw = new LayoutDocumentFloatingWindow()
{
RootDocument = anchorableDocument
};
Layout.FloatingWindows.Add(fw);
fwc = new LayoutDocumentFloatingWindowControl(
fw as LayoutDocumentFloatingWindow)
{
Width = fwWidth,
Height = fwHeight,
Left = contentModel.FloatingLeft,
Top = contentModel.FloatingTop
};
}
//fwc.Owner = Window.GetWindow(this);
//fwc.SetParentToMainWindowOf(this);
_fwList.Add(fwc);
Layout.CollectGarbage();
UpdateLayout();
Dispatcher.BeginInvoke(new Action(() =>
{
if (startDrag)
fwc.AttachDrag();
//.........这里部分代码省略.........
示例9: LayoutSerializationCallbackEventArgs
public LayoutSerializationCallbackEventArgs(LayoutContent model, object previousContent)
{
Cancel = false;
Model = model;
Content = previousContent;
}
示例10: Attach
internal override void Attach(LayoutContent model)
{
_document = model as LayoutDocument;
base.Attach(model);
}
示例11: Close
private void Close( LayoutContent contentToClose )
{
if( !contentToClose.CanClose )
return;
var layoutItem = GetLayoutItemFromModel( contentToClose );
if( layoutItem.CloseCommand != null )
{
if( layoutItem.CloseCommand.CanExecute( null ) )
layoutItem.CloseCommand.Execute( null );
}
else
{
if( contentToClose is LayoutDocument )
_ExecuteCloseCommand( contentToClose as LayoutDocument );
else if( contentToClose is LayoutAnchorable )
_ExecuteCloseCommand( contentToClose as LayoutAnchorable );
}
}
示例12: GetLayoutItemFromModel
/// <summary>
/// Return the LayoutItem wrapper for the content passed as argument
/// </summary>
/// <param name="content">LayoutContent to search</param>
/// <returns>Either a LayoutAnchorableItem or LayoutDocumentItem which contains the LayoutContent passed as argument</returns>
public LayoutItem GetLayoutItemFromModel(LayoutContent content)
{
return _layoutItems.FirstOrDefault(item => item.LayoutElement == content);
}
示例13: _ExecuteDockAsDocumentCommand
internal void _ExecuteDockAsDocumentCommand(LayoutContent content)
{
content.DockAsDocument();
}
示例14: _ExecuteDockAsDocumentCommand
internal void _ExecuteDockAsDocumentCommand(LayoutContent content)
{
content.DockAsDocument();
OnLayoutConfigurationChanged();
}
示例15: _ExecuteFloatCommand
internal void _ExecuteFloatCommand(LayoutContent contentToFloat)
{
contentToFloat.Float();
OnLayoutConfigurationChanged();
}