Current filter:
                                You should refresh the page.
                                  • I am using a dropdown button.  The popup I have had sever items in it.  I have it so that the button remembers the last command.  I need a way to set a default command on that drop down button in code.  That way they have the default command in each drop down. Please help!

                                • Svetlana (DevExpress Support) 02.22.2016

                                  Hi,

                                  Are you using DropDownButton? If so, what control are you using as its drop-down control?

                                  In addition, clarify what "default command" means. I understand that you have some kind of a drop-down button with different items. However, it is unclear what the "default command" for this button is and how it should look and function. Do you mean that a particular item should be always shown in a popup window of any drop-down button without the necessity to add it manually each time? The more details you give us, the faster we will be able to find an appropriate solution for you.

                                  I look forward to your response.

                                • Christopher Herrington 02.22.2016

                                  It is a drop down split button on the ribbon bar.  I am using a popup menu.  When you click on an item and have the remember last command set it puts the icon and remembers the command last executed.  The problem is when it load there is no default command so the top of the split button is empty and does nothing until I actually click on of the items in the menu.  I need to set a default command.

                                • Dimitros (DevExpress Support) 02.22.2016

                                  Hello Christopher,

                                  Based on your description, I assume that when you click a popup item, you execute a method that marks the clicked item as default.  If so, call this method for required items manually when your application starts.

                                  If this doesn't help, please provide us with a sample project illustrating your scenario. This will allow us to better understand your task and find a solution for you much faster.

                                • Christopher Herrington 02.22.2016

                                  Here is a sample.  When you click on the button select command 1 or 2 and then you will see it adds it to the drop down.  I need to be able to set a default command to the control when it initializes.

                                1 Solution

                                Creation Date Importance Sort by

                                Hi,

                                Now, I understand what you are talking about. You enabled the BarButtonItem.RememberLastCommand option. It is possible to set a particular item link as a last command by using the Reflection:

                                [C#]
                                PropertyInfo info = typeof(BarButtonItem).GetProperty("LastClickedLink", BindingFlags.NonPublic | BindingFlags.Instance); info.SetValue(btnSplit, popSplit.ItemLinks[0]);
                                [VB.NET]
                                Dim info As PropertyInfo = GetType(BarButtonItem).GetProperty("LastClickedLink", BindingFlags.NonPublic Or BindingFlags.Instance) info.SetValue(btnSplit, popSplit.ItemLinks(0))

                                Execute this code in the Form.OnShown method.

                                I will also inform our developers of the necessity to provide a public property to set the last command.

                                Once you try this approach, let me know if it operates as expected.

                                • Christopher Herrington 02.25.2016

                                  That is perfect works as expected.

                                • Svetlana (DevExpress Support) 02.25.2016

                                  Do not hesitate to contact us if you have any questions or concerns. 

                                • Paolo For. 09.05.2019

                                  Hi Svetlana,
                                  is there a new property in 19.1 to set the last command ?

                                  thank you

                                • Stas (DevExpress Support) 09.05.2019

                                  Hello,

                                  I've created a separate ticket on your behalf (T812452: BarItem - How to set the last command). Please refer to it for further discussion.