How to Hide Maximize and Minimize Buttons in WPF ChromelessWindow?
In ChromelessWindow, Maximize and Minimize Buttons can be hidden by customizing its TitleBar Template in WPF ChromelessWindow.
The following Code sample demonstrates the same
XAML
<!-- Normal window --> <MultiTrigger> <MultiTrigger.Conditions> <Condition Property="ResizeMode" Value="CanMinimize"/> <Condition Property="WindowState" Value="Normal"/> </MultiTrigger.Conditions> <Setter Property="Visibility" Value="Collapsed" TargetName="PART_MaximizeButton"/> <Setter Property="Visibility" Value="Collapsed" TargetName="PART_RestoreButton"/> <Setter Property="IsEnabled" Value="False" TargetName="PART_MaximizeButton"/> <Setter Property="IsEnabled" Value="False" TargetName="PART_RestoreButton"/> </MultiTrigger> <!-- Maximize window --> <MultiTrigger> <MultiTrigger.Conditions> <Condition Property="ResizeMode" Value="CanMinimize"/> <Condition Property="WindowState" Value="Maximized"/> </MultiTrigger.Conditions> <Setter Property="Visibility" Value="Collapsed" TargetName="PART_RestoreButton"/> <Setter Property="Visibility" Value="Collapsed" TargetName="PART_MaximizeButton"/> <Setter Property="IsEnabled" Value="False" TargetName="PART_MaximizeButton"/> <Setter Property="IsEnabled" Value="False" TargetName="PART_RestoreButton"/> </MultiTrigger> <!-- Resize with grip --> <MultiTrigger> <MultiTrigger.Conditions> <Condition Property="ResizeMode" Value="CanResizeWithGrip"/> <Condition Property="WindowState" Value="Normal"/> </MultiTrigger.Conditions> <Setter Property="Visibility" Value="Visible" TargetName="PART_Resizegrip"/> <Setter Property="Visibility" Value="Collapsed" TargetName="PART_MaximizeButton"/> <Setter Property="Visibility" Value="Collapsed" TargetName="PART_RestoreButton"/> </MultiTrigger>
Screenshot
Figure 1. Before Customization
Figure 2. After Customization.
Sample
C#: ChromelessWindowCustomization
VB: ChromelessWindowCustomization
Conclusion
I hope you enjoyed learning about how to hide maximize and minimize buttons in WPF ChromelessWindow.
You can refer to our WPF ChromelessWindow feature tour page to know about its other groundbreaking feature representations. You can also explore our WPF ChromelessWindow documentation 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 forums, Direct-Trac, or feedback portal. We are always happy to assist you!