我如何获得智能感知?

发布于 2024-11-07 19:03:39 字数 368 浏览 0 评论 0原文

我是一名正在学习 WPF 的网页设计师。我需要学习的事情之一是风格。

当我使用 CSS 时,我所要做的就是访问像 w3 这样的网站,看看各种标签支持哪些样式。 WPF 中的示例似乎依赖于智能感知,而不是固定的样式列表。

其他人似乎可以毫无问题地添加 。当他们这样做时,BackgroundHover 由智能感知提供。他们不必寻找它。我的机器上并非如此。由于我找不到已发布的属性列表来设置该样式,所以我被留在了众所周知的小溪中。

如何修复样式的智能感知或找出给定的第三方 UserControl 支持哪些样式?

I'm a web designer learning WPF. One of the things I need to learn are styles.

When I was using CSS all I had to do is go to a site like w3 and see what styles were supported for various tags. The examples from WPF seem to rely on intellisense instead of a fixed list of styles.

Other people seem to be able to add <Setter Property="BackgroundHover" Value="Red"> without an issue. When they do it BackgroundHover is supplied by intellisense. They don't have to search for it. This is not the case on my machine. Since I can not find a published list of properties to set for the style I'm left up the proverbial creek.

How do I either fix intellisense for styles or find out what styles are supported for a given third party UserControl?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

小红帽 2024-11-14 19:03:39

为了使智能感知适用于以这种方式设置的属性,它需要知道设置器所应用的类型。因此,在样式中,将 TargetType 设置为您将应用样式的类型,智能感知可以为值提供建议。

<Style TargetType="MyType">
    <Setter Property="MyProperty" Value="MyValue" />
</Style>

您还需要确保计算机上的所有内容都具有正确的版本。相同的库、相同版本的 Visual Studio、相同代码等。此外,XAML 文件中不应有任何其他错误。那时智能感知应该可以工作了。

For intellisense to work for properties set that way, it needs to know what type that the setter is being applied to. So in the style, set the TargetType to the type that you will be applying the style to and intellisense can offer suggestions to the values.

<Style TargetType="MyType">
    <Setter Property="MyProperty" Value="MyValue" />
</Style>

You'll also want to make sure you have the right versions of everything on your machine. The same libraries, same versions of Visual Studio, the same code, etc. Also there should not be any other errors in the XAML file. Intellisense should be working then.

倾`听者〃 2024-11-14 19:03:39

我刚刚在 description of VS 2010 SP1 download

智能感知样式

让您可以轻松修改 XAML 中已有的样式。现在,您可以以基于 TargetType 的样式获取属性及其值的 IntelliSense。

I just found this in the description of VS 2010 SP1 download:

Style IntelliSense

Lets you easily modify styles that you already have in XAML. Now you get IntelliSense for properties and their values in a style that is based on the TargetType.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文