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:
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?
I found two solutioins :
Set the Window.WindowStyle
property to WindowStyle.None
I. Disabling Minimize, Maximize buttons :
This can be achieved by setting Window.ResizeMode
property to ResizeMode.NoResize
. It will disable the minimize and maximize buttons. Furthermore, the window will not resize by mouse click+drag.
II. Not showing Icon and Close button:
Unfortunately, this feature is not available in WPF. To achieve this, you can try setting the WS_EX_DLGMODALFRAME window style by calling [Get/Set]WindowLong (pInvoking in to Win32) from the SourceInitialized event on the Window class.
@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>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With