本文整理汇总了C#中LayoutContent.FindParent方法的典型用法代码示例。如果您正苦于以下问题:C# LayoutContent.FindParent方法的具体用法?C# LayoutContent.FindParent怎么用?C# LayoutContent.FindParent使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类LayoutContent
的用法示例。
在下文中一共展示了LayoutContent.FindParent方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: 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();
//.........这里部分代码省略.........