2013-06-01 142 views
0

您好,我正在使用DevExpress WinForms控件創建Windows應用程序。如何隱藏/顯示DevExpress窗口的UserControls應用程序

我已經創建了主頁,其中包含RibbonControl在頂部和一個導航欄左和大面板作爲所有用戶控件的容器說MainPanel。

當我點擊導航欄中的任何項目,然後usercontrol將添加到MainPanel。 它工作正常。

但是當我想從一個用戶控件移動到另一個用戶控件, - 如何訪問MainPanel和 - 如何顯示另一個用戶控件並隱藏當前用戶控件。

代碼來添加用戶控件在面板:

mainPanel.Controls.Clear(); 
CustomerListControl c1 = new CustomerListControl(); 
c1.Dock = DockStyle.Fill; 
mainPanel.Controls.Add(c1); 

請幫助!

+0

請發佈更多代碼,以顯示DevExpress中的哪些類。另外,當你的上面的代碼被執行時會發生什麼?新的統一通信是不是顯示或什麼? –

回答

0

我在我的代碼中使用網格的主面板和正常工作對我來說,

GridMain.Children.Clear(); 
CustomerListControl1 c1 = new CustomerListControl1(); 
CustomerListControl2 c2 = new CustomerListControl2(); 
GridMain.Childern.Add(c1); //if you use grid 
GridMain.Children.Add(c2); //if you use a grid 
GridMain.Children[0].Visibility = Visibility.Collapsed; 
GridMain.Children[1].Visibility = Visibility.Collapsed; 
GridMain.InvalidateVisual(); 
現在如果你要顯示C1呼叫

GridMain.Children[0].Visibility = Visibility.Visible; 
GridMain.Children[1].Visibility = Visibility.Collapsed; 

,如果你想C2是

可視化的通話

GridMain.Children[0].Visibility = Visibility.Collapsed; 
GridMain.Children[1].Visibility = Visibility.Visible; 

我希望這有助於

相關問題