■ WindowsUIView 클래스에서 팝업 플라이아웃(Pop-up Flyout) 컨테이너를 사용하는 방법을 보여준다.
▶ MainForm.cs
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 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 |
using System.Drawing; using System.Windows.Forms; using DevExpress.Utils; using DevExpress.XtraBars.Docking2010; using DevExpress.XtraBars.Docking2010.Views; using DevExpress.XtraBars.Docking2010.Views.WindowsUI; using DevExpress.XtraEditors; namespace TestProject { /// <summary> /// 메인 폼 /// </summary> public partial class MainForm : XtraForm { //////////////////////////////////////////////////////////////////////////////////////////////////// Field ////////////////////////////////////////////////////////////////////////////////////////// Private #region Field /// <summary> /// 윈도우즈 UI 뷰 /// </summary> private WindowsUIView windowsUIView; /// <summary> /// 핍업 플라이아웃 /// </summary> private Flyout popupFlyout; #endregion //////////////////////////////////////////////////////////////////////////////////////////////////// Constructor ////////////////////////////////////////////////////////////////////////////////////////// Public #region 생성자 - MainForm() /// <summary> /// 생성자 /// </summary> public MainForm() { InitializeComponent(); Padding = new Padding(10); #region 윈도우즈 UI 뷰를 설정한다. this.windowsUIView = new WindowsUIView(); this.windowsUIView.AddTileWhenCreatingDocument = DefaultBoolean.False; #endregion #region 문서 관리자를 설정한다. DocumentManager documentManager = new DocumentManager(); documentManager.ContainerControl = this; documentManager.View = windowsUIView; #endregion #region 이벤트를 설정한다. this.windowsUIView.QueryControl += windowsUIView_QueryControl; this.windowsUIView.QueryStartupContentContainer += windowsUIView_QueryStartupContentContainer; this.windowsUIView.NavigationBarsShowing += WindowsUIView_NavigationBarsShowing; #endregion } #endregion //////////////////////////////////////////////////////////////////////////////////////////////////// Method ////////////////////////////////////////////////////////////////////////////////////////// Private #region 윈도우즈 UI 뷰 컨트롤 질의하기 - windowsUIView_QueryControl(sender, e) /// <summary> /// 윈도우즈 UI 뷰 컨트롤 질의하기 /// </summary> /// <param name="sender">이벤트 발생자</param> /// <param name="e">이벤트 인자</param> private void windowsUIView_QueryControl(object sender, QueryControlEventArgs e) { if(e.Document.ControlName == "PopupControl") { e.Control = new PopupControl(); } else { WindowsUIView view = sender as WindowsUIView; LabelControl labelControl = new LabelControl(); labelControl.Dock = DockStyle.Fill; labelControl.AutoSizeMode = LabelAutoSizeMode.None; labelControl.Appearance.TextOptions.HAlignment = HorzAlignment.Center; labelControl.Appearance.TextOptions.VAlignment = VertAlignment.Center; labelControl.Appearance.Font = new Font("나눔고딕코딩", 24f, FontStyle.Bold); labelControl.Text = $"{e.Document.Header} Content"; e.Control = labelControl; } } #endregion #region 윈도우즈 UI 뷰 시작 컨텐트 컨테이너 질의하기 - windowsUIView_QueryStartupContentContainer(sender, e) /// <summary> /// 윈도우즈 UI 뷰 시작 컨텐트 컨테이너 질의하기 /// </summary> /// <param name="sender">이벤트 발생자</param> /// <param name="e">이벤트 인자</param> private void windowsUIView_QueryStartupContentContainer(object sender, QueryContentContainerEventArgs e) { #region 타일 컨테이너를 설정한다. TileContainer tileContainer = new TileContainer(); tileContainer.Caption = "Tile Container"; tileContainer.Properties.ItemSize = 150; tileContainer.Properties.ShowGroupText = DefaultBoolean.True; Document document1 = new Document(); document1.Header = "Document 1"; Document document2 = new Document(); document2.Header = "Document 2"; Document document3 = new Document(); document3.Header = "Document 3"; Document document4 = new Document(); document4.Header = "Document 4"; Tile tile1 = new Tile(); Tile tile2 = new Tile(); Tile tile3 = new Tile(); Tile tile4 = new Tile(); tile1.Group = "Group 1"; tile1.Properties.ItemSize = TileItemSize.Medium; tile1.Document = document1; tile1.CheckedChanged += tile_CheckedChanged; tile2.Group = "Group 1"; tile2.Properties.ItemSize = TileItemSize.Medium; tile2.Document = document2; tile3.Group = "Group 1"; tile3.Properties.ItemSize = TileItemSize.Medium; tile3.Document = document3; tile4.Group = "Group 2"; tile4.Properties.ItemSize = TileItemSize.Medium; tile4.Document = document4; tile1.Elements.Add(new TileItemElement { Text = "Document 1" }); tile2.Elements.Add(new TileItemElement { Text = "Document 2" }); tile3.Elements.Add(new TileItemElement { Text = "Document 3" }); tile4.Elements.Add(new TileItemElement { Text = "Document 4" }); tileContainer.Items.AddRange(new BaseTile[] { tile1, tile2, tile3, tile4 }); (sender as WindowsUIView).ContentContainers.Add(tileContainer); e.ContentContainer = tileContainer; #endregion #region 팝업 문서/플라이아웃을 설정한다. Document popupDocument = new Document(); popupDocument.ControlName = "PopupControl"; popupDocument.ControlTypeName = "TestProject.PopupControl"; this.windowsUIView.Documents.Add(popupDocument); this.popupFlyout = new Flyout(); this.popupFlyout.Name = "popupFlyout"; this.popupFlyout.Properties.Style = FlyoutStyle.Popup; this.popupFlyout.Document = popupDocument; this.windowsUIView.ContentContainers.Add(this.popupFlyout); #endregion } #endregion #region 윈도우즈 UI 뷰 탐색바 표시시 처리하기 - WindowsUIView_NavigationBarsShowing(sender, e) /// <summary> /// 윈도우즈 UI 뷰 탐색바 표시시 처리하기 /// </summary> /// <param name="sender">이벤트 발생자</param> /// <param name="e">이벤트 인자</param> private void WindowsUIView_NavigationBarsShowing(object sender, NavigationBarsCancelEventArgs e) { TileContainer tileContainer = e.ContentContainer as TileContainer; WindowsUIView view = tileContainer.Manager.View as WindowsUIView; Document document = view.ActiveDocument as Document; if(document.ControlName == "PopupControl") { e.Cancel = true; } } #endregion #region 타일 체크 변경시 처리하기 - tile_CheckedChanged(sender, e) /// <summary> /// 타일 체크 변경시 처리하기 /// </summary> /// <param name="sender">이벤트 발생자</param> /// <param name="e">이벤트 인자</param> private void tile_CheckedChanged(object sender, TileEventArgs e) { this.windowsUIView.ActivateContainer(this.popupFlyout); } #endregion } } |