English 中文(简体)
Intelllisense 在 XAML 编辑中的刷子属性在哪里寻找选项?
原标题:Where does Intellisense look for options for the Brush property in XAML editing?

在 WPF 应用程序中, 如果我想创建一个矩形, 我开始在 XAML 中写入 :

<Rectangle Fill=

我输入了最后一个 < code_ / code > 字符后, 视觉工作室的 Intellisense 将为此 < code> Fill 属性给我一系列选项, 如 AliceBlue、 AntiqueWhite 等。 我发现这些常数来自类 < code> Brushes , 但本类定义的常数不会包含在该属性的选项列表中 。 所以我有两个问题 。

  1. property Fill is of type Brush. Type Brush is an ordinary type, and is not a enum type. How does Intellisense look for options for such a property?
  2. Is it possible for Intellisense to consider objects defined outside the core assembly of WPF as options for a certain property?

谢谢 谢谢

问题回答

System.Windows.Media.Brushes 中提取的 Intellisense只是两个默认的 SolidColorBrush 值。 您可以使用任何Brush类型, 如 LineearGradientBrush , RadialGradientBrush , 或 ImagiBrush 。 如果您想要定义自己的颜色, 您可以使用一种颜色的十六进制值( 例如, # FF000, 对于 ARGB 值 255 单数, 255 红色, 0 绿色, 0 蓝色), 或者您可以在 XAML 中定义资源, 并用 StaticResource 引用它们 (如果您打算在运行时更改此值的话) 。

Intellisense 使用反射查找变量、方法、函数。 该颜色列表来自此类, 看起来像 :

public sealed class Brushes {
    public static SolidColorBrush AliceBlue {
        get {
            return KnownColors.SolidColorBrushFromUint(-984833);
        }
    }

    public static SolidColorBrush AntiqueWhite {
        get {
            return KnownColors.SolidColorBrushFromUint(-332841);
        }
    }
}

不清楚您在第二个问题中询问什么, 但它只提供与特定集会直接相关的内容。 如果您能澄清这个问题, 请做 。

Intelisense is showing you the list so because of those Definition here xs:attribute name="Fill" type="StringToBrushConverter"/

看着弦笔的近亲 冲刷器

name="StringToBrushConverter">
    pattern value="AliceBlue|AntiqueWhite|Aqua|Aquamarine|Azure|Beige|Bisque|Black|BlanchedAlmond|Blue|BlueViolet|Brown|BurlyWood|CadetBlue|Chartreuse|Chocolate|Coral|CornflowerBlue|Cornsilk|Crimson|Cyan|DarkBlue|DarkCyan|DarkGoldenrod|DarkGray|DarkGreen|DarkKhaki|DarkMagenta|DarkOliveGreen|DarkOrange|DarkOrchid|DarkRed|DarkSalmon|DarkSeaGreen|DarkSlateBlue|DarkSlateGray|DarkTurquoise|DarkViolet|DeepPink|DeepSkyBlue|DimGray|DodgerBlue|Firebrick|FloralWhite|ForestGreen|Fuchsia|Gainsboro|GhostWhite|Gold|Goldenrod|Gray|Green|GreenYellow|Honeydew|HotPink|IndianRed|Indigo|Ivory|Khaki|Lavender|LavenderBlush|LawnGreen|LemonChiffon|LightBlue|LightCoral|LightCyan|LightGoldenrodYellow|LightGray|LightGreen|LightPink|LightSalmon|LightSeaGreen|LightSkyBlue|LightSlateGray|LightSteelBlue|LightYellow|Lime|LimeGreen|Linen|Magenta|Maroon|MediumAquamarine|MediumBlue|MediumOrchid|MediumPurple|MediumSeaGreen|MediumSlateBlue|MediumSpringGreen|MediumTurquoise|MediumVioletRed|MidnightBlue|MintCream|MistyRose|Moccasin|NavajoWhite|Navy|OldLace|Olive|OliveDrab|Orange|OrangeRed|Orchid|PaleGoldenrod|PaleGreen|PaleTurquoise|PaleVioletRed|PapayaWhip|PeachPuff|Peru|Pink|Plum|PowderBlue|Purple|Red|RosyBrown|RoyalBlue|SaddleBrown|Salmon|SandyBrown|SeaGreen|SeaShell|Sienna|Silver|SkyBlue|SlateBlue|SlateGray|Snow|SpringGreen|SteelBlue|Tan|Teal|Thistle|Tomato|Transparent|Turquoise|Violet|Wheat|White|WhiteSmoke|Yellow|YellowGreen"/>
    </xs:restriction>
  </xs:simpleType>

所有东西都取自WPFe schemma, 地点在: C: 方案文件 (x86) 微软视觉工作室 11.0XmlSchemas





相关问题
building .net applications without Visual Studio

I m interested to hear about people working with building .net applications using MSBuild, NAnt or similar tools. What are you using, why are you using it instead of the VS IDE? I like to use ...

Tips for debugging a made-for-linux application on windows?

I m trying to find the source of a bug I have found in an open-source application. I have managed to get a build up and running on my Windows machine, but I m having trouble finding the spot in the ...

Visual Studio 2010 Beta 2: Can I print in color?

I have to turn in a hard copy of some code with an assignment. Is there any way in Visual Studio 2010 to print C# source code with syntax highlighting? PS: The assignment is solving a math problem, ...

Set Select command in code

On button Click I want to Set the Select command of a Gridview. I do this and then databind the grid but it doesn t work. What am i doing wrong? protected void bttnView_Click(object sender, ...

WPF design-time context menu

I am trying to create a custom wpf control, I m wondering how I can add some design-time features. I ve googled and can t seem to get to my goal. So here s my simple question, how can I add an entry ...