Current filter:
                                You should refresh the page.
                                Support Center
                                4

                                1 Solution

                                Creation Date Rating Importance Sort by
                                0

                                By default, XAF allows defining whether a SingleChoiceAction click should show a dropdown or execute an action item immediately using the ShowItemsOnClick and DefaultItemMode  properties. You can easily change these properties based on the number of the New action items. However, a triangle glyph is always shown by default. The SingleChoiceAction does not currently provide built-in means for replacing a dropdown with a simple button either.
                                Currently, to improve user experience with such configurations, you can customize the underlying bar item in the YourSolutionName.Module.Win project.

                                XAF 16.2+
                                You can use the following controller to hide a drop-down list from the NewObjectAction in case it contains only one element:

                                [C#]
                                using DevExpress.ExpressApp; using DevExpress.ExpressApp.Actions; using DevExpress.ExpressApp.Win.SystemModule; using DevExpress.XtraBars; ... namespace YourSolutionName.Module.Win.Controllers { public class CustomizeNewActionController : WindowController { BarButtonItem newActionBarButtonItem; protected override void OnFrameAssigned() { base.OnFrameAssigned(); WinNewObjectViewController newObjectViewController = Frame.GetController<WinNewObjectViewController>(); SingleChoiceAction newObjectAction = newObjectViewController.NewObjectAction; newObjectAction.CustomizeControl += NewObjectAction_CustomizeControl; newObjectAction.ItemsChanged += NewObjectAction_ItemsChanged; } private void NewObjectAction_ItemsChanged(object sender, ItemsChangedEventArgs e) { if(newActionBarButtonItem != null) { SingleChoiceAction newObjectAction = (SingleChoiceAction)sender; int choicesCount = newObjectAction.Items.Count; if(choicesCount == 1) { newActionBarButtonItem.ButtonStyle = BarButtonStyle.Default; } } } private void NewObjectAction_CustomizeControl(object sender, CustomizeControlEventArgs e) { newActionBarButtonItem = e.Control as BarButtonItem; } } }

                                Here are screenshots showing the results in the application UI before and after this customization.

                                Before:


                                After:


                                Also, you can use the same approach with the CloneObjectAction (it is a part of the CloneObjectViewController). Refer to the following documentation articles to learn more about this solution:
                                    Concepts > Extend Functionality > Built-in Controllers and Actions
                                    Concepts > Extend Functionality > Customize Controllers and Actions
                                    Task-Based Help > How to: Customize Action Controls
                                    DevExpress.XtraBars > BarButtonItem > ButtonStyle
                                    DevExpress.XtraBars > BarButtonItem > ActAsDropDown


                                For older versions
                                Check out the How to display a dropdown without a triangle glyph for a SingleChoiceAction ticket for code examples.

                                Show all comments
                                • Richard Nieuwland 05.29.2013

                                  I've tried the solutions you gave me but even if there's one item left in de collection it still shows the Pulldown functionality.
                                  I'm using the web module by the way, so no windows. Maybe that's the issue?

                                • If you click the button with a single item, then it will be executed by default. The dropdown will be shown only if you click the arrow icon. I have just re-tested this with our MainDemo (Win and Web).
                                  If you cannot live with the dropdown even though it allows executing the Action by just clicking on it, then I can only advise you implement your own SimpleAction. I hope this helps.

                                • Martin_Inderbitzin 10.31.2014

                                  Hi there

                                  Are there any plans to implement in future versions, that we can hide this arrow icon?
                                  I think, it makes no sense, when there is only one item.
                                  I found this "problem" in the NewObjectAction and CloneObjectAction.

                                  Because it's only an unattractive UI-thing, I won't create my own SimpleAction for this.

                                • We do not have immediate plans to change this behavior, Nevertheless, thank you for your feedback. We will definitely take your opinion into account in the future.
                                • Geoffrey Jones 02.21.2015

                                  Hi Devexpress Team,

                                  We would like to see an option to hide the drop-down arrow for New/Clone actions also. For our use case, we feel that the drop-down adds unnecessary clutter and complexity to the UI.

                                  Thanks for your consideration.

                                  Regards,

                                  Geoff.

                                • Pawel Botwina 03.06.2015

                                  Hi,
                                  I agree the drop-down should be invisible when only the CurrentObject can be created.

                                • kirsten greed 01.23.2017
                                  I agree too

                                If you need additional product information, write to us at info@devexpress.com or call us at +1 (818) 844-3383

                                FOLLOW US

                                DevExpress engineers feature-complete Presentation Controls, IDE Productivity Tools, Business Application Frameworks, and Reporting Systems for Visual Studio, along with high-performance HTML JS Mobile Frameworks for developers targeting iOS, Android and Windows Phone. Whether using WPF, ASP.NET, WinForms, HTML5 or Windows 10, DevExpress tools help you build and deliver your best in the shortest time possible.

                                Copyright © 1998-2017 Developer Express Inc.
                                All trademarks or registered trademarks are property of their respective owners