C# – How to hide ‘Minimize’, ‘Maximize’ and ‘Close’ buttons from PrismUserControl WPF

cmvvmprismwpf

In my Prism 6 WPF MVVM application I use the following PrismUserControl WPF for displaying of modal notification dialogs:

<UserControl x:Class="CommonWpfControlLibrary.NotificationDialogPopupView"
         xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
         xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
         xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
         xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
         xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation"
         xmlns:prism="http://prismlibrary.com/"             
         prism:ViewModelLocator.AutoWireViewModel="True"
         mc:Ignorable="d" 
         d:DesignHeight="300" d:DesignWidth="300" MaxHeight="300" MaxWidth="600">

    <StackPanel Orientation="Vertical" Margin="20">
        <TextBlock Text="{Binding Message}" TextWrapping="Wrap"/>
        <telerik:RadButton Content="OK" Command="{Binding OnOkPressedCommand}" HorizontalAlignment="Center" Width="50" Margin="0 10 0 0"/>
    </StackPanel>
</UserControl>

In the Views where I use this UserControl as a modal dialog content I define it as following:

<i:Interaction.Triggers>
    <prism:InteractionRequestTrigger SourceObject="{Binding NotificationRequest, Mode=OneWay}">
        <prism:PopupWindowAction IsModal="True" CenterOverAssociatedObject="True">
            <prism:PopupWindowAction.WindowContent>
                <commonControls:NotificationDialogPopupView/>
            </prism:PopupWindowAction.WindowContent>
        </prism:PopupWindowAction>
    </prism:InteractionRequestTrigger>
</i:Interaction.Triggers>

When I activate the dialog it is displayed, for example, as the following:
enter image description here

But as you can see 'Minimize', 'Maximize' and 'Close' buttons are visible and enabled. And the system menu (activated in upper left corner of the dialog) is enabled too. How can I hide 'Minimize', 'Maximize' and 'Close' buttons and disable the system menu?

Best Answer

@Evangelink was close. You would use the WindowStyle property, but you must supply an actual Style. Something like:

<Style TargetType="{Window}">
     <Setter Property="" Value="" />
</Style>
Related Topic