(1 item) |
|
(1 item) |
|
(5 items) |
|
(1 item) |
|
(1 item) |
|
(2 items) |
|
(2 items) |
|
(4 items) |
|
(1 item) |
|
(6 items) |
|
(2 items) |
|
(4 items) |
|
(1 item) |
|
(4 items) |
|
(2 items) |
|
(1 item) |
|
(1 item) |
|
(1 item) |
|
(1 item) |
|
(1 item) |
|
(1 item) |
|
(1 item) |
|
(1 item) |
|
(2 items) |
|
(2 items) |
|
(5 items) |
|
(3 items) |
|
(1 item) |
|
(1 item) |
|
(1 item) |
|
(3 items) |
|
(1 item) |
|
(1 item) |
|
(2 items) |
|
(8 items) |
|
(2 items) |
|
(7 items) |
|
(2 items) |
|
(2 items) |
|
(1 item) |
|
(2 items) |
|
(1 item) |
|
(2 items) |
|
(4 items) |
|
(1 item) |
|
(5 items) |
|
(1 item) |
|
(3 items) |
|
(2 items) |
|
(2 items) |
|
(8 items) |
|
(7 items) |
|
(3 items) |
|
(7 items) |
|
(6 items) |
|
(1 item) |
|
(2 items) |
|
(5 items) |
|
(5 items) |
|
(7 items) |
|
(3 items) |
|
(7 items) |
|
(16 items) |
|
(10 items) |
|
(27 items) |
|
(15 items) |
|
(15 items) |
|
(13 items) |
|
(16 items) |
|
(15 items) |
When you install the WinFX SDK preview, it provides a few feaures to help with writing Avalon projects in Visual Studio
.NET 2005 beta 2. (Collectively these features go by the codename Fidalgo.) It includes an XML schema for XAML
documents. You can find this file at C:\Program Files\Microsoft Visual Studio 8\Xml\Schemas\Avalon2005.xsd
.
(Or thereabouts - obviously it depends on where you installed VS.NET 2005 beta 2...)
This schema's job is to provide IntelliSense when you edit XAML files. Its purpose is not to provide a formal definition of how XAML files should be structured. XAML doesn't have a fixed vocabulary because it can be used to work with any number of .NET types. (Contrary to popular perception, XAML isn't tied to Avalon.) Not only is it open to adding new element types, it is also open to extending the set of properties that can be applied to existing elements. Anyone can define new 'attached properties' that can be applied to any element.
This means that any schema definition will tend to hit either of two problems. It might be too restrictive, and disallow documents that are in fact valid XAML. Or it might be too lax, and allow documents that are not valid. A schema that tries to walk the line between these two problems will most likely end up suffering from both...
The schema supplied with Fidalgo exhibits both problems. This isn't a major issue, because the schema file is just there to improve the editing experience - it has no formal significance. However, when the schema falls short, the effect can be quite annoying, because IntelliSense stops working all of a sudden, and you get meaningless warnings when you build.
One problem that has been particularly irksome for me is that the schema doesn't recognize that the Grid
lets
you put <RowDefinition>
and <ColumnDefinition>
elements as children of the
Grid
. Since the Grid
is a really useful layout element, I end up not having IntelliSense
an awful lot of the time...
One workaround is just to use the verbose syntax. Rather than putting these row/column definition elements directly
under the Grid
, you can put them inside a <Grid.ColumnDefinitions<
or
<Grid.RowDefinitions<
element. The schema knows about this style, it just doesn't know that the grid
lets you omit these as a shorthand.
However, I like the more concise style. So I've hacked my schema so it recognizes this format.
If you'd like to hack your schema, find the definition of the dGrid
complex type. This is on line 7064
on my system. It looks like this:
<xs:complexType name="dGrid"> <xs:choice minOccurs="0" maxOccurs="unbounded"> <xs:group ref="cGrid" minOccurs="0"/> <xs:any namespace="http://schemas.microsoft.com/winfx/xaml/2005" processContents="strict"/> <xs:group ref="gUIElement" minOccurs="0"/> </xs:choice> ...
I've added the following after that second <xs:group ... >
, and before the closing
</xs:choice>
:
<!-- Hack to allow ColumnDefinition and RowDefinition to be used in line --> <xs:element name="ColumnDefinition" type="dColumnDefinition" /> <xs:element name="RowDefinition" type="dRowDefinition" />
You'll need to exit VS.NET and restart it for this change to take effect. But from then on, it will accept the more concise grid/column definition syntax without loss of IntelliSense.