如何使默认隐藏的控件显示在 Visual Studio 2010 WPF 设计器中? [英] How to make control that is Hidden by default show up in the Visual Studio 2010 WPF designer?

查看:35
本文介绍了如何使默认隐藏的控件显示在 Visual Studio 2010 WPF 设计器中?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个具有隐藏可见性的控件,因为它绑定到视图模型中的一个属性,该属性的默认值导致它被隐藏.我可以通过 XAML 访问它,但我希望它仍然显示在设计器中.

I have a control that has Hidden visibility because it is bound to a property in the View Model whose default value causes it to be hidden. I can access it through the XAML but I'd like it still shown in the designer.

有没有一种干净的方法来做到这一点?目前,我正在手动编辑 Visibility 属性以使其显示出来,但我宁愿不必这样做,以防我忘记将其改回来.

Is there a clean way of doing this? For now, I'm manually editing the Visibility attribute to make it show up, but I'd rather not have to do that, in case I forget to change it back.

推荐答案

不确定它是否更清晰,但您应该在 ctor 中将其设置为 Visible(在初始化之前);

Not sure it is a lot cleaner but you should set it to Visible in the ctor (before the Initialize);

这篇关于如何使默认隐藏的控件显示在 Visual Studio 2010 WPF 设计器中?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆