gpt4 book ai didi

wpf - WPF中有DesignMode属性吗?

转载 作者:行者123 更新时间:2023-12-03 04:49:55 25 4
gpt4 key购买 nike

在 Winforms 中你可以说

if ( DesignMode )
{
// Do something that only happens on Design mode
}

WPF中有类似的东西吗?

最佳答案

确实有:

<强> System.ComponentModel.DesignerProperties.GetIsInDesignMode

示例:

using System.ComponentModel;
using System.Windows;
using System.Windows.Controls;

public class MyUserControl : UserControl
{
public MyUserControl()
{
if (DesignerProperties.GetIsInDesignMode(this))
{
// Design-mode specific functionality
}
}
}

关于wpf - WPF中有DesignMode属性吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/425760/

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