Is there a way to hide the RadToolBarSeparator if its moved into the OverflowButton?

1 Answer 25 Views
ToolBar
Dominik
Top achievements
Rank 1
Iron
Iron
Dominik asked on 10 Jan 2024, 02:22 PM | edited on 10 Jan 2024, 02:23 PM


Hope there is a way. Thanks

Dominik

1 Answer, 1 is accepted

Sort by
0
Accepted
Stenly
Telerik team
answered on 15 Jan 2024, 12:15 PM

Hello Dominik,

May I ask if you could try setting the RadToolBar.OverflowMode attached property to Never on the RadToolBarSeparator instances? This way, they will not be added to the overflow area.

<telerik:RadToolBar HorizontalAlignment="Center"
                    VerticalAlignment="Center"
                    AutoHideOverflowButton="True">
    <telerik:RadButton Content="FILE" />
    <telerik:RadButton Content="EDIT " />
    <telerik:RadButton Content="VIEW" />
    <telerik:RadButton Content="BUILD" />
    <telerik:RadButton Content="DEBUG" />
    <telerik:RadToolBarSeparator telerik:RadToolBar.OverflowMode="Never"/>
    <telerik:RadButton Content="HELP" />
</telerik:RadToolBar>

The produced result is as follows:

In the above image, all of the RadButton elements are added to the overflow area, without the RadToolBarSeparator instance.

With this being said, I hope the provided information will be of help to you.

Regards,
Stenly
Progress Telerik

Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.

Dominik
Top achievements
Rank 1
Iron
Iron
commented on 15 Jan 2024, 03:57 PM

It works, but the Separator is staying in the ToolBar, which isn't very visually pleasing.
Stenly
Telerik team
commented on 18 Jan 2024, 01:27 PM

Currently, this is the default behavior of the items, to which the RadToolBar.OverflowMode attached property is set to Never.

In order to hide items that have the above-mentioned property set to them, a custom logic would have to be introduced that will check if the item at the next index in the Items collection is visible.

For example, one way of achieving this would be with a custom RadToolBarOverflowPanel panel, that has the OnVisualChildrenChanged method overridden. In it, you could check, which elements are added to the overflow menu and show/hide the RadToolBarSeparator based on this information. After that, the default control template of the RadToolBar control has to be extracted and modified and the RadToolBarOverflowPanel has to be substituted with the custom one.

With this being said, I have attached a sample project, which contains a sample implementation of the above suggestion.

Dominik
Top achievements
Rank 1
Iron
Iron
commented on 18 Jan 2024, 01:35 PM | edited

Thanks for the help
Tags
ToolBar
Asked by
Dominik
Top achievements
Rank 1
Iron
Iron
Answers by
Stenly
Telerik team
Share this question
or