【问题标题】:UWP ContentDialog Disable PrimaryButtonUWP ContentDialog 禁用 PrimaryButton
【发布时间】:2018-11-30 19:48:49
【问题描述】:

我有一个 ContentDialog,它链接它的

<ContentDialog
    x:Class="ParadigmaN.Apps.Common.Controls.EditPersonContentDialog"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:local="using:ParadigmaN.Apps.Common.Controls"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    mc:Ignorable="d"
    x:Uid="EditorPersonas"
    Title=""
    PrimaryButtonText="Aceptar"
    SecondaryButtonText="Cancelar"
    PrimaryButtonClick="ContentDialog_PrimaryButtonClick"
    SecondaryButtonClick="ContentDialog_SecondaryButtonClick"
    PrimaryButtonCommand="{Binding ElementName=CtrPerson,Path=DataContext.GuardarCommand}">
    <Grid>
        <local:PersonControl x:Name="CtrPerson"/>
    </Grid>
</ContentDialog>

但即使我的 CanExecuteCommand 返回 false,PrimaryButton 仍保持启用状态。

如何从 ContentDialog 控制 PrimaryButton 的启用状态?

【问题讨论】:

  • 令人严重不安的是,该按钮上的此命令与其他命令不同。我认为这是一个错误并想报告它,但找不到在哪里这样做。

标签: xaml uwp


【解决方案1】:

有一个名为 IsPrimaryButtonEnabled 的属性,您可以使用该属性来启用或禁用 ContentDialog 的 PrimaryButton。

https://docs.microsoft.com/en-us/uwp/api/windows.ui.xaml.controls.contentdialog.isprimarybuttonenabled

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-10-23
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-11-18
    • 1970-01-01
    相关资源
    最近更新 更多