本文整理汇总了C#中Eto.Forms.Control.GetContainerView方法的典型用法代码示例。如果您正苦于以下问题:C# Control.GetContainerView方法的具体用法?C# Control.GetContainerView怎么用?C# Control.GetContainerView使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Eto.Forms.Control
的用法示例。
在下文中一共展示了Control.GetContainerView方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: AddSubview
public static void AddSubview (this Control control, Control subView, bool useRoot = false)
{
var parentController = control.GetViewController (false);
if (parentController != null) {
parentController.AddChildViewController (subView.GetViewController ());
return;
}
if (useRoot) {
var window = control.GetContainerView () as UIWindow;
if (window != null) {
window.RootViewController = subView.GetViewController ();
return;
}
}
var parentView = control.GetContentView ();
if (parentView != null) {
parentView.AddSubview (subView.GetContainerView ());
return;
}
throw new EtoException("Coult not add subview to parent");
}
示例2: Remove
public void Remove(Control child)
{
for (int y = 0; y < views.GetLength(0); y++)
for (int x = 0; x < views.GetLength(1); x++)
{
if (object.ReferenceEquals(views[y, x], child))
{
var view = child.GetContainerView();
view.RemoveFromSuperview();
views[y, x] = null;
if (Widget.Loaded)
LayoutParent();
return;
}
}
}
示例3: Add
public void Add(Control child, int x, int y)
{
var current = views[y, x];
if (current != null)
{
var currentView = current.GetContainerView();
if (currentView != null)
currentView.RemoveFromSuperview();
}
views[y, x] = child;
if (child != null)
{
var view = child.GetContainerView();
if (Widget.Loaded)
LayoutParent();
Control.AddSubview(view);
}
else if (Widget.Loaded)
LayoutParent();
}