gpt4 book ai didi

c# - 如何从 PrismUserControl WPF 中隐藏 'Minimize' 、 'Maximize' 和 'Close' 按钮?

转载 作者:行者123 更新时间:2023-11-30 23:21:21 26 4
gpt4 key购买 nike

在我的 Prism 6 WPF MVVM 应用程序中,我使用以下 PrismUserControl WPF 来显示模态通知对话框:

<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>

在我将此 UserControl 用作模态对话框内容的 View 中,我将其定义如下:

<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>

当我激活对话框时,它会显示,例如,如下所示: enter image description here

但如您所见,“最小化”、“最大化”和“关闭”按钮可见且已启用。并且系统菜单(在对话框的左上角激活)也被启用。 如何隐藏“最小化”、“最大化”和“关闭”按钮并禁用系统菜单?

最佳答案

@Evangelink 很接近。您可以使用 WindowStyle 属性,但必须提供实际的样式。像这样的东西:

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

关于c# - 如何从 PrismUserControl WPF 中隐藏 'Minimize' 、 'Maximize' 和 'Close' 按钮?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39243463/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com