Category / Section
How to hide the expander arrow in GroupBarItem?
1 min read
User can hide the Expand/Collapsed sign in GroupBarItem. It can be achieved by setting the Expander button visibility as Collapsed. This Expander button can be fetched by the name "Expander" from Template using FindName method. The following code demonstrates the same.
Code Example: [Xaml]
<syncfusion:GroupBar Name="group" VisualMode="MultipleExpansion"> <syncfusion:GroupBarItem Header="One" Loaded="Item1_Loaded" Name="Item1"> <syncfusion:GroupView Name="groupView" > <syncfusion:GroupViewItem Text="List View"/> <syncfusion:GroupViewItem Text="Show ContextMenu"/> <syncfusion:GroupViewItem Text="Show ToolTip"/> </syncfusion:GroupView> </syncfusion:GroupBarItem> <syncfusion:GroupBarItem Header="Two" Loaded="Item1_Loaded" /> <syncfusion:GroupBarItem Header="Three" Loaded="Item1_Loaded"/> <syncfusion:GroupBarItem Header="Four" Loaded="Item1_Loaded"/> <syncfusion:GroupBarItem Header="Five" Loaded="Item1_Loaded"/> </syncfusion:GroupBar>
Code Example: [C#]
private void Item1_Loaded(object sender, RoutedEventArgs e) { if (sender is GroupBarItem) { FrameworkElement btn = (sender as GroupBarItem).Template.FindName("Expander", sender as GroupBarItem) as FrameworkElement; if(btn != null) { //Hide the Expander button Visibility btn.Visibility = Visibility.Collapsed; } } }
Screenshot
Sample: GroupBarSample