我试图使用以下代码以编程方式在制表符栏中创建两个窗格:
var middlePanel = new LayoutPanel
{
Orientation = Orientation.Vertical,
DockHeight = new GridLength(250)
};
rootPanel.Children.Add(middlePanel);
var paneGroup = new LayoutAnchorablePaneGroup
{
DockHeight = new GridLength(200)
};
middlePanel.Children.Add(new LayoutDocumentPane());
middlePanel.Children.Add(paneGroup);
var validationEditorPane = new LayoutAnchorablePane();
paneGroup.Children.Add(validationEditorPane);
validationEditorPane.Children.Add(new LayoutAnchorable { ContentId = "Validation", Title = "Validation" });
var searchEditorPane = new LayoutAnchorablePane();
paneGroup.Children.Add(searchEditorPane);
searchEditorPane.Children.Add(new LayoutAnchorable { ContentId = "Search", Title = "Search" });但是,上面的代码在没有制表符的情况下创建了相邻的两个窗格。在运行时,我可以将搜索窗格拖到验证窗格中,以将它们移动到选项卡中。这意味着必须有可能以编程的方式实现这一点,但我不知道如何实现。
有什么建议吗?
发布于 2016-01-04 13:00:51
结果发现这比我想象的要容易。我所要做的就是将LayoutAnchorables添加到同一个LayoutAnchorablePane对象中:
var tabPane = new LayoutAnchorablePane();
paneGroup.Children.Add(tabPane);
tabPane.Children.Add(new LayoutAnchorable { ContentId = "Validation", Title = "Validation" });
tabPane.Children.Add(new LayoutAnchorable { ContentId = "Search", Title = "Search" });https://stackoverflow.com/questions/33729417
复制相似问题