WPF:使元素不显示为公共或朋友? [英] WPF: Making an element not appear as public or friend?

查看:22
本文介绍了WPF:使元素不显示为公共或朋友?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在设计器中,我怎样才能(例如)在它所在的窗口中将按钮设为私有?我记得在 Windows 窗体中有一种方法可以做到这一点,但我不知道在 WPF 中如何.

In the designer, how can I (for instance) make a button be private within the Window that it is on? I remember a way to do this in Windows Forms, but I don't know how in WPF.

有没有办法通过 Visual Studio 做到这一点?

Is there a way to do it through Visual Studio?

推荐答案

尝试使用

<Button x:FieldModifier="private" />

在您的对象元素上.

这似乎并没有直接融入到设计器中,您可以直接在属性编辑器"中对其进行编辑.您必须自己将其添加到标记中.但是,它是受支持的,因此至少您可以获得智能感知来帮助您将其放在那里.

This doesn't appear to be baked right into the designer where you can just edit it in the Properties Editor. You'll have to add this to the markup yourself. However, it is supported so at least you can get intellisense to help you put it there.

这篇关于WPF:使元素不显示为公共或朋友?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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