Where does Intellisense look for options for the Brush property in XAML editing?

In a WPF application, if I want to create a rectangle, I start writing this in XAML:

<Rectangle Fill=

After entering the last character, =Intellisense from Visual Studio will give me a set of parameters for this property Fill, such as AliceBlue, AntiqueWhite, etc. I found out that these constants belong to the class Brushes, but the constants defined in my own class will not be contained in the parameter list of this property. Therefore, I have two questions.

  • The property Fillis of type Brush. A type Brushis a regular type and is not an enumeration type. How does Intellisense look for options for this property?
  • Is it possible for Intellisense to consider objects defined outside the main WPF assembly as parameters for a specific property?

thank

+3
source share
2 answers

intellisense draws from System.Windows.Media.Brushes, which are only pairs of default values SolidColorBrush. You can use any type of Brush, for example LinearGradientBrush, RadialGradientBrushor ImageBrush. If you want to define your own colors, you can use a hexadecimal color value (for example, # FFFF0000, for aRGB values ​​of 255 opacity, 255 red, 0 green, 0 blue), or you can define resources in XAML and reference them with StaticResourceor DynamicResource(if you intend to change this value at runtime).

Intellisense , , . , :

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

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

, , , . , , .

0

Intelisense , -          xs:attribute name="Fill" type="StringToBrushConverter"/

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, : C:\Program Files (x86)\Microsoft Visual Studio 11.0\Xml\Schemas

0

All Articles