0
votes

Hello I am Creating Windows Application Using DevExpress WinForms Controls.

I have Created Main Page which Contains RibbonControl at the top and One Navigation bar to left and big Panel which acts as container for all user controls say MainPanel.

when i click on any item from Navigation bar then usercontrol will add to MainPanel. it works fine.

But When i want to move from one usercontrol to another user control, - how to access the MainPanel and - how to show another user control and hide current user control.

Code to add UserControl In Panel :

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

Please Help!!

1
Please post more code as to show what classes are from the DevExpress. Also, what happens when your above code gets executed? Is the new UC not showing up or what?Shakti Prakash Singh

1 Answers

0
votes

i have used Grid for main panel in my code and works fine for me,

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();

now if you want c1 to be displayed call

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

and if you want c2 to be visible call

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

i hope this helps