Articles in this section
Category / Section

How to hide close and overflow button on WPF floating toolbar window ?

4 mins read

We can hide the close button and Overflow button in floating toolbar window. It can be achieved by editing the close button and overflow button visibility in FloatingToolBar template. The following code demonstrates the same using WPF ToolBar.

Code Example: [Xaml]

 

<Style x:Key="Style1" TargetType="{x:Type syncfusion:FloatingToolBar}">
 
<Setter Property="Background" Value="White"/>
 
<Setter Property="HorizontalAlignment" Value="Center"/>
 
<Setter Property="VerticalAlignment" Value="Center"/>
 
<Setter Property="ControlsResourceDictionary">
 
<Setter.Value>
 
<ResourceDictionary 
 
Source="/Syncfusion.Shared.WPF;component/Controls/ToolBarAdv/Themes/ToolBarResources.xaml"/>
 
</Setter.Value>
 
</Setter>
 
<Setter Property="Template">
 
<Setter.Value>
 
<ControlTemplate TargetType="{x:Type syncfusion:FloatingToolBar}">
 
<Grid x:Name="PART_LayoutGrid">
 
<Border x:Name="Root" Background="White" >
 
<Border Name="_Border"  BorderThickness="6">
 
<Grid x:Name="PART_Root">
 
<Grid.RowDefinitions>
 
<RowDefinition Height="Auto"/>
 
<RowDefinition Height="*"/>
 
<RowDefinition Height="Auto"/>
 
</Grid.RowDefinitions>
 
<Border Grid.Row="1" Margin="1,0,1,1"  Background="{TemplateBinding Background}">
 
<ContentPresenter />
 
</Border>
 
<ContentControl x:Name="PART_Client" Grid.Row="1" />
 
<Border x:Name="PART_Resizegrip"  Cursor="SizeNWSE" Visibility="Collapsed" 
 
Background="Transparent" Grid.Row="1" 
 
HorizontalAlignment="Right" VerticalAlignment="Bottom" Margin="3">
 
<Grid Background="Transparent" HorizontalAlignment="Right" VerticalAlignment="Bottom">
 
<Path Fill="White"
Data="M 9,1 L 11,1 L 11,3 L 9,3 Z M 5,5 L 7,5 L 7,7 L 5,7 Z M 9,5 L 11,5 L 11,7 L 9,7 Z M 1,9 L 3,9 L 3,11 L 1,11 Z M 5,9 L 7,9 L 7,11 L 5,11 Z M 9,9 L 11,9 L 11,11 L 9,11 Z"
/>
 
<Path  Fill="Gray"
Data="M 8,0 L 10,0 L 10,2 L 8,2 Z M 4,4 L 6,4 L 6,6 L 4,6 Z M 8,4 L 10,4 L 10,6 L 8,6 Z M 0,8 L 2,8 L 2,10 L 0,10 Z M 4,8 L 6,8 L 6,10 L 4,10 Z M 8,8 L 10,8 L 10,10 L 8,10 Z"
/>
 
<Thumb x:Name="PART_ResizeGripThumb" Opacity="0.0" Cursor="SizeNWSE"/>
 
</Grid>
 
</Border>
 
<Border x:Name="PART_Title"  Margin="1" Background="#FF808080" VerticalAlignment="Center">
 
<Grid>
 
<Grid.ColumnDefinitions>
 
<ColumnDefinition Width="Auto"/>
 
<ColumnDefinition Width="*"/>
 
<ColumnDefinition Width="Auto"/>
 
</Grid.ColumnDefinitions>
 
<TextBlock Text="{TemplateBinding Title}" TextTrimming="WordEllipsis" Grid.Column="1" 
 
Foreground="White"  Margin="2" HorizontalAlignment="Left" VerticalAlignment="Center"/>
 
<Thumb Grid.ColumnSpan="2" Opacity="0" x:Name="PART_TitleFloatingThumb" />
 
<Border Grid.Column="2" Background="Transparent" CornerRadius="0" Visibility="Collapsed" 
 
Width="Auto" VerticalAlignment="Center">
 
<StackPanel Orientation="Horizontal">
 
<ToggleButton x:Name="PART_AddRemoveButton" />
 
<Popup x:Name="PART_OverflowPopup" PlacementTarget="{Binding ElementName=PART_OverflowButton}" 
 
StaysOpen="False">
 
<Border BorderBrush="Gray" BorderThickness="1" Background="White" MaxWidth="150">
 
<Border.Effect>
 
<DropShadowEffect ShadowDepth="3" BlurRadius="7" Opacity="0.5"/>
 
</Border.Effect>
 
<StackPanel>
 
<syncfusion:ToolBarOverflowPanel Margin="2" 
 
x:Name="PART_ToolBarOverflowPanel"></syncfusion:ToolBarOverflowPanel>
 
</StackPanel>
 
</Border>
 
</Popup>
 
<!-- Hide Close Button -->
 
<Button x:Name="PART_CloseButton"  HorizontalAlignment="Center" Visibility="Collapsed"  
 
VerticalAlignment="Top" HorizontalContentAlignment="Left" VerticalContentAlignment="Top">
 
</Button>
</StackPanel>
</Border>
 
</Grid>
</Border>
</Grid>
</Border>
</Border>
 
<Thumb x:Name="PART_TopThumb" Height="5" VerticalAlignment="Top" Opacity="0" Cursor="SizeNS" 
Margin="0,1,0,0"/>
 
<Thumb x:Name="PART_RightThumb" Width="5" HorizontalAlignment="Right" Cursor="SizeWE" Opacity="0" 
Margin="0,0,4,0"/>
 
<Thumb x:Name="PART_BottomThumb" Height="5" VerticalAlignment="Bottom" Cursor="SizeNS" 
Margin="0,0,0,4" Opacity="0"/>
 
<Thumb x:Name="PART_LeftThumb" Width="5" HorizontalAlignment="Left" Cursor="SizeWE" Opacity="0" Margin="4,0,0,0"/>
 
<Thumb x:Name="PART_TopLeftThumb" HorizontalAlignment="Left" VerticalAlignment="Top" Cursor="SizeNWSE" Background="Red" Opacity="0" Width="8" Height="8"/>
 
<Thumb x:Name="PART_TopRightThumb" HorizontalAlignment="Right" VerticalAlignment="Top" Cursor="SizeNESW" Background="Red" Opacity="0" Width="8" Height="8"/>
 
<Thumb x:Name="PART_BottomLeftThumb" HorizontalAlignment="Left" VerticalAlignment="Bottom" Cursor="SizeNESW" Background="Red" Opacity="0" Width="8" Height="8"/>
 
<Thumb x:Name="PART_BottomRightThumb" HorizontalAlignment="Right" VerticalAlignment="Bottom" Cursor="SizeNWSE" Background="Red" Opacity="0" Width="8" Height="8"/>
 
</Grid>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
 
<!-- ToolBarAdv  -->
<syncfusion:ToolBarManager x:Name="toolBarManager" FloatingToolBarStyle="{StaticResource Style1}">
 
<syncfusion:ToolBarManager.Resources>
 
<Style TargetType="Button">
<Setter Property="Height" Value="20" />
<Setter Property="Width" Value="20"/>
</Style>
<Style TargetType="ToggleButton">
<Setter Property="Height" Value="20"/>
<Setter Property="Width" Value="20"/>
</Style>
 
</syncfusion:ToolBarManager.Resources>
 
<syncfusion:ToolBarManager.TopToolBarTray>
 
<syncfusion:ToolBarTrayAdv VerticalAlignment="Top"  >
 
<syncfusion:ToolBarAdv ToolBarName="Standard" >
 
<Button syncfusion:ToolBarAdv.Label="New Document" Height="22" Width="22" 
syncfusion:ToolBarAdv.Icon="Images/NewDocumentHS.png">
 
<Image Source="Images/NewDocumentHS.png" Width="16" Height="16"/>
 
</Button>
 
<Button  syncfusion:ToolBarAdv.Label="Open Document" Height="22" Width="22" 
syncfusion:ToolBarAdv.Icon="Images/openHS.png">
 
<Image Source="Images/openHS.png"  Width="16" Height="16"/>
 
</Button>
 
<Button  syncfusion:ToolBarAdv.Label="Save Document" Height="22" Width="22" syncfusion:ToolBarAdv.Icon="Images/saveHS.png">
 
<Image Source="Images/saveHS.png"  Width="16" Height="16"/>
 
</Button>
 
<Button  syncfusion:ToolBarAdv.Label="Save Document" Height="22" Width="22" syncfusion:ToolBarAdv.Icon="Images/saveAllHS.png">
 
<Image Source="Images/saveAllHS.png"  Width="16" Height="16"/>
 
</Button>
 
<syncfusion:ToolBarItemSeparator  />
 
<Button  syncfusion:ToolBarAdv.Label="Print Document"  Height="22" Width="22" syncfusion:ToolBarAdv.Icon="Images/PrintHS.png" >
 
<Image Source="Images/PrintHS.png"  Width="16" Height="16"/>
 
</Button>
 
</syncfusion:ToolBarAdv>
 
<syncfusion:ToolBarAdv   ToolBarName="ClipBoard">
 
<Button syncfusion:ToolBarAdv.Label="Cut" Height="22" Width="22" syncfusion:ToolBarAdv.Icon="Images/CutHS.png">
 
<Image Source="Images/CutHS.png"  Width="16" Height="16"/>
 
</Button>
 
<Button  syncfusion:ToolBarAdv.Label="Copy" Height="22" Width="22" 
syncfusion:ToolBarAdv.Icon="Images/CopyHS.png" >
 
<Image Source="Images/CopyHS.png"  Width="16" Height="16"/>
 
</Button>
 
<Button syncfusion:ToolBarAdv.Label="Paste" Height="22" Width="22" syncfusion:ToolBarAdv.Icon="Images/PasteHS.png"  >
 
<Image Source="Images/PasteHS.png"  Width="16" Height="16"/>
 
</Button>
 
</syncfusion:ToolBarAdv>
 
<syncfusion:ToolBarAdv Band="1"   ToolBarName="Extras">
 
<Button syncfusion:ToolBarAdv.Label="Insert Picture" Height="22" Width="22"  syncfusion:ToolBarAdv.Icon="Images/InsertPictureHS.png">
 
<Image Source="Images/InsertPictureHS.png"  Width="16" Height="16"/>
 
</Button>
 
<Button  syncfusion:ToolBarAdv.Label="Insert Hyperlink"  Height="22" Width="22" 
syncfusion:ToolBarAdv.Icon="Images/InsertHyperlinkHS.png">
 
<Image Source="Images/InsertHyperlinkHS.png"  Width="16" Height="16"/>
 
</Button>
 
<Button  syncfusion:ToolBarAdv.Label="Insert Table" Height="22" Width="22" 
syncfusion:ToolBarAdv.Icon="Images/TableHS.png">
 
<Image Source="Images/TableHS.png"  Width="16" Height="16"/>
 
</Button>
 
<syncfusion:ToolBarItemSeparator  />
 
<Button  syncfusion:ToolBarAdv.Label="Read Only" Height="22" Width="22"  syncfusion:ToolBarAdv.Icon="Images/ProtectFormHS.png">
 
<Image Source="Images/ProtectFormHS.png"  Width="16" Height="16"/>
 
</Button>
 
<Button  syncfusion:ToolBarAdv.Label="Read Only" Height="22" Width="22"  
syncfusion:ToolBarAdv.Icon="Images/CheckSpellingHS.png">
 
<Image Source="Images/CheckSpellingHS.png"  Width="16" Height="16"/>
 
</Button>
 
</syncfusion:ToolBarAdv>
 
</syncfusion:ToolBarTrayAdv>
 
</syncfusion:ToolBarManager.TopToolBarTray>
 
</syncfusion:ToolBarManager>

 

Screenshot

 

hide close button and Overflow button in floating toolbar window

 

 

Conclusion

I hope you enjoyed learning about how to hide close and overflow button on WPF floating toolbar window.

You can refer to our WPF ToolBar featuretour page to know about its other groundbreaking feature representations and documentation, and how to quickly get started for configuration specifications. You can also explore our example to understand how to create and manipulate data.

For current customers, you can check out our components from the License and Downloads page. If you are new to Syncfusion, you can try our 30-day free trial to check out our other controls.

If you have any queries or require clarifications, please let us know in the comments section below. You can also contact us through our support forumsDirect-Trac, or feedback portal. We are always happy to assist you!

Did you find this information helpful?
Yes
No
Help us improve this page
Please provide feedback or comments
Comments (0)
Please sign in to leave a comment
Access denied
Access denied