Current filter:
                                You should refresh the page.
                                  • Hello XAF Team,

                                    In Web UI, how can I customize the height of actions in an action container view item (in detail views)?

                                    I hope to increase the height of these actions, because their height looks too small.


                                1 Solution

                                Creation Date Importance Sort by

                                Hello James,

                                In versions 16.2+, we recommend that you accomplish this task through the action's CustomCSSClassName model property. See details in the Action Customization section of the How to: Customize ASP.NET Layout Elements Using Custom CSS Classes article. Take a look at an example of such a CSS class in the ASPxMenu - How to align items' text vertically ticket.

                                Other tasks, such as specifying a custom width, can be implemented on the server side. To change server-side control settings, handle the ActionBase.CustomizeControl event as described at How to: Customize Action Controls:

                                using DevExpress.ExpressApp; using DevExpress.ExpressApp.Actions; using DevExpress.ExpressApp.Web.Templates.ActionContainers.Menu; using System.Web.UI.WebControls; namespace MainDemo.Module.Web { public class ViewController1 : ViewController<DetailView> { public ViewController1() { SimpleAction action = new SimpleAction(this, "MyAction12", "DetailViewActions"); action.CustomizeControl += Action_CustomizeControl; } private void Action_CustomizeControl(object sender, CustomizeControlEventArgs e) { SimpleActionMenuActionItem button = e.Control as SimpleActionMenuActionItem; if (button != null) { button.MenuItem.ItemStyle.Width = Unit.Pixel(300); } } } }


                                In previous versions, you can access and customize ActionContainerHolder as follows:

                                public class ViewController2 : ObjectViewController<DetailView, Payment> { protected override void OnActivated() { base.OnActivated(); foreach (WebActionContainerViewItem viewItem in View.GetItems<WebActionContainerViewItem>()) { viewItem.ControlCreated += viewItem_ControlCreated; } } void viewItem_ControlCreated(object sender, EventArgs e) { ActionContainerHolder control = (ActionContainerHolder)((WebActionContainerViewItem)sender).Control; control.Menu.Height = 100; } protected override void OnDeactivated() { base.OnDeactivated(); foreach (WebActionContainerViewItem viewItem in View.GetItems<WebActionContainerViewItem>()) { viewItem.ControlCreated -= viewItem_ControlCreated; } } }

                                Note that it may be also required to increase the layout item's height during the layout customization via the Model Editor.

                                See Also
                                WinForms - How to customize ActionContainerViewItem's Action height and width.

                                • James Zhong 01.28.2013

                                  Thanks Anatol for your example code. It works!

                                • Anatol (DevExpress Support) 01.28.2013

                                  You are welcome!