Hide/disable "x" close button

Hi,

I want to create a MessageBox like window with the ChromelessWindow. Is it possible to disable or hide (better) the close button of the window? I've tried the WindowsStyle="ToolWindow" but this has no effect when using the FluentDark Theme. Many thanks in advance!

Best regards Andreas


8 Replies

TB Thirupathi Bala Krishnan Syncfusion Team December 27, 2021 06:22 PM UTC

Hi Andreas, 
 
Thanks for contacting Syncfusion support. 
 
Currently, we are validating the reported issue "Hide/Disable the close button in chromeless window". We’ll provide further details on December 28, 2021. We appreciate your patience until then. 
 
Regards, 
Thirupathi B. 



AA Arunthivakar Azhagu Syncfusion Team December 28, 2021 12:30 PM UTC

Hi Andreas,


Since your requirement is to create a MessageBox like a window using the ChromelessWindow so we suggest to hide the minimize and maximize button by setting properties ShowMaximizeButton="False" and ShowMinimizeButton="False" in ChromelessWindow. Please refer to the below image.




Please let us know if you have any other concerns.



Regards,

Arunthivakar A.



AS Andreas Schramm December 30, 2021 05:34 AM UTC

Hi Arunthivakar,

thanks for your response. This was the first thing I have done. But how to get rid of the close button ("x").

Unfortunately there is no property like "ShowCloseButton" or sim



AA Arunthivakar Azhagu Syncfusion Team December 30, 2021 07:55 AM UTC

Hi Andreas,


Currently, we don't have support for hiding the close button in ChromelessWindow. But as per your requirement, we can able to provide you the customized style for the ChromelessWindow to hide the close button so could you please tell us the themes you are using so that will be helpful for us to provide the prompt solution for this.



Regards,

Arunthivakar A



AS Andreas Schramm January 11, 2022 05:25 AM UTC

Hello Arunthivakar,


I'm using currently the WPF Fluent Dark and Fluent Light theme in my projects.


Best regards

Andreas



AA Asarudeen Abdulajis Syncfusion Team January 11, 2022 04:39 PM UTC

Hi Andreas, 
 
Based on your suggestions, we modified the ChromelessWindow control template. We added the template to App.Xaml and bind the template key value to the ChromelessWindow Template property. The visibility of the Close button has been collapsed in this scenario. 
 
# App.Xaml: 
   
<local:TitleButton 
                                            x:Name=”CloseButton” 
                                            shell:WindowChrome.IsHitTestVisibleInChrome=”True” 
                                            Command=”local:ChromelessWindow.CloseWindow” 
                                            Style=”{StaticResource WPFGlyphButtonStyle}” 
                                            Template=”{TemplateBinding CloseButtonTemplate}” 
                                            Width=”40” 
                                            Height=”32” 
                                            Visibility=”Collapsed”     
                                            ToolTip=”{Sync_Resources:SharedLocalizationResourceExtension ResourceName=CloseTooltip}”> 
                                                <local:TitleButton.Content> 
                                                    <Path 
                                                Name=”closePath” 
                                                Width=”10” 
                                                Height=”10” 
                                                HorizontalAlignment=”Center” 
                                                VerticalAlignment=”Center” 
                                                Data=”M5.70801 5.11182L10 9.40381L9.29199 10.1118L5 5.81982L0.708008 10.1118L0              9.40381L4.29199 5.11182L0 0.819824L0.708008 0.111816L5 4.40381L9.29199 0.111816L10 0.819824L5.70801 5.11182Z” 
                                                Fill=”{Binding Foreground, ElementName=CloseButton}” 
                                                SnapsToDevicePixels=”True” 
                                                Stretch=”Fill” 
                                                StrokeThickness=”0" /> 
                                                </local:TitleButton.Content> 
  </local:TitleButton> 
 
# MainWindow.Xaml 
 
<shared:ChromelessWindow x:Class="WpfApp1.MainWindow" 
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
        xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
        xmlns:local="clr-namespace:WpfApp1"   
        Template="{StaticResource SyncfusionChromelessWindowControlTemplate}" 
        mc:Ignorable="d"  
        xmlns:shared="clr-namespace:Syncfusion.Windows.Shared;assembly=Syncfusion.Shared.Wpf"  
        xmlns:Skins="clr-namespace:Syncfusion.SfSkinManager;assembly=Syncfusion.SfSkinManager.WPF" 
        Skins:SfSkinManager.VisualStyle="FluentLight" 
        Title="MainWindow" Height="450" Width="800"> 
    <Grid> 
         
    </Grid> 
</shared:ChromelessWindow> 
 
Please find the screenshot for your reference. 
 
 
 
Please find the sample link. 
 
Regards, 
Asarudeen 



AS Andreas Schramm January 12, 2022 04:33 PM UTC

Hi Arunthivakar,


thank you very much for your support. This is exactly what I was looking for!


Best regards

Andreas



SA Sulthan Amanu Syncfusion Team January 13, 2022 11:21 AM UTC

Hi Andreas,


We are glad to know that the provided solution resolved your reported issue at your end. Please let us know if you need any further assistance on this. As always, we are happy to assist you.


Regards,

Sulthan amanu


Loader.
Up arrow icon