■ 첫번째 LayoutAnchorablePane 객체를 찾는 방법을 보여준다.
▶ 예제 코드 (C#)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 |
using Xceed.Wpf.AvalonDock.Layout; #region 첫번째 LayoutAnchorablePane 찾기 - FindFirstLayoutAnchorablePane(layoutAnchorablePaneGroup) /// <summary> /// 첫번째 LayoutAnchorablePane 찾기 /// </summary> /// <param name="layoutAnchorablePaneGroup">LayoutAnchorablePaneGroup</param> /// <returns>LayoutAnchorablePane</returns> public LayoutAnchorablePane FindFirstLayoutAnchorablePane(LayoutAnchorablePaneGroup layoutAnchorablePaneGroup) { LayoutAnchorablePane layoutAnchorablePane = null; foreach(ILayoutAnchorablePane layoutAnchorablePaneInterface in layoutAnchorablePaneGroup.Children) { if(layoutAnchorablePaneInterface is LayoutAnchorablePane) { return layoutAnchorablePaneInterface as LayoutAnchorablePane; } if(layoutAnchorablePaneInterface is LayoutAnchorablePaneGroup) { layoutAnchorablePane = FindFirstLayoutAnchorablePane(layoutAnchorablePaneInterface as LayoutAnchorablePaneGroup); if(layoutAnchorablePane != null) { return layoutAnchorablePane; } } } return null; } #endregion #region 첫번째 LayoutAnchorablePane 찾기 - FindFirstLayoutAnchorablePane(layoutPanel) /// <summary> /// 첫번째 LayoutAnchorablePane 찾기 /// </summary> /// <param name="layoutPanel">LayoutPanel</param> /// <returns>LayoutAnchorablePane</returns> public LayoutAnchorablePane FindFirstLayoutAnchorablePane(LayoutPanel layoutPanel) { LayoutAnchorablePane layoutAnchorablePane = null; foreach(ILayoutPanelElement layoutPanelElementInterface in layoutPanel.Children) { if(layoutPanelElementInterface is LayoutAnchorablePane) { return layoutPanelElementInterface as LayoutAnchorablePane; } if(layoutPanelElementInterface is LayoutAnchorablePaneGroup) { layoutAnchorablePane = FindFirstLayoutAnchorablePane(layoutPanelElementInterface as LayoutAnchorablePaneGroup); if(layoutAnchorablePane != null) { return layoutAnchorablePane; } } } return null; } #endregion |