We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon

Want to dynamically increase size of BarItem used as a menu

I have a DropDownBarItem used as an undo menu in my application. When it drops down, I have the list of actions that can be undone. The very last item is a special baritem that is disabled. I update the text whenever the other bar items in the menu get highlighted. It displays the number of actions that will be undone (like Microsoft Word). My problem is when the number of actions goes > 10. The text of the last item was "Undoing 9 action(s)". When it becomes "Undoing 10 actions(s)", the last parentheses gets dropped. How can I force the baritem to resize when the text on it has changed?

4 Replies

AD Administrator Syncfusion Team February 9, 2005 02:44 PM UTC

Hi Justin, I''m having a little trouble understanding what you''re trying to do. I have a couple questions for you: 1) Is there any reason you''re using a disabled BarItem instead of a StaticBarItem? 2) How exactly are you using the DropDownBarItem? Wouldn''t hosting BarItems in a ParentBarItem be easier? I''ve noticed that BarItems in ParentBarItems dynamically resize, if that helps. Regards, Gregory Austin Syncfusion, Inc.


JK Justin Koh February 9, 2005 05:36 PM UTC

There is no reason. I could switch to a StaticBarItem. The reason that I''m using a DropDownBarItem is that I want to handle a click on the button (to do one undo) as well as having a drop down list of the undo items. Things will resize if I only highlight item 10, but most people scroll from item 1 - 10.


AD Administrator Syncfusion Team February 10, 2005 05:16 PM UTC

Hi Justin, There''s a property in ParentBarItem that allows it to operate as a DropDown. If you set ParentStyle=DropDown then it''ll function that way. Regarding the resize, I''m not aware of any way to force a BarItem to resize. I can think of two possible workarounds for this: 1) Include a StaticBarItem that''s wider than your BarItem needs to be. This should cause the BarItem to be drawn at a larger size as soon as the DropDown appears. A simple picture of a line would work well. 2) Instead of setting the text to "Undo 1 Item(s)", set the text to "Undo 01 Item(s)" Regards, Gregory Austin Syncfusion, Inc.


JK Justin Koh February 10, 2005 10:56 PM UTC

Thanks for your help. I actually am using a parentbaritem with the dropdown property set. I''ll try your suggestion of the static bar item later.

Loader.
Live Chat Icon For mobile
Up arrow icon