I am using a ribbon control an using bar item click and Dock layout manager I am calling tab but not able to set user control in it.
private void BarButtonItem_ItemClick(object sender, DevExpress.Xpf.Bars.ItemClickEventArgs e) {
ActivateOrCreate("Company");
}
private void BarButtonItem_ItemClick_1(object sender, DevExpress.Xpf.Bars.ItemClickEventArgs e) {
ActivateOrCreate("Branch");
}
private void ActivateOrCreate(string caption) {
LayoutPanel layoutPanel = DockTabbed.GetItems().OfType<LayoutPanel>().Where(x => String.Equals(x.Caption, caption)).FirstOrDefault();
if (layoutPanel == null) {
layoutPanel = new LayoutPanel() { Caption = caption };
layoutPanel.Content = new TextBlock() { Text = caption };
DockTabbed.DockController.Dock(layoutPanel, TabbedView, DevExpress.Xpf.Layout.Core.DockType.Fill);
}
DockTabbed.Activate(layoutPanel);
}
in this I want to show User Control in layout panel.
Winform controls usually use Controls.add method to adding and showing a control or usercontrol! use like this:
layoutPanel.Controlss.Add(new TextBlock() { Text = caption, Size=new Size(x,y),... };
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.