> > > > > > > Static Analysis Design Time Compile Time Runtime Localization > > > > > > > > > > > XOML engine Xoml Type Info Workflow BAML engine XAML engine Presentation Framework.dll (PF.dll) PresentationCore.dll (PC.dll) XamlTypeInfo WindowsBase.dll Mscorlib, System, System.Xml 3.x BAML engine PF.dll PC.dll Windows Base.dll WPF WF, WCF, More… XAML XamlTypeInfo engine System.Xaml.dll Mscorlib, System, System.Xml > > > > > > > Object Member Value StartObject Canvas StartObject Button StartMember Children StartMember Value Background “Green” StartMember Value Content “OK” StartObject StartMember Value Button Content “Cancel”

Download Report

Transcript > > > > > > > Static Analysis Design Time Compile Time Runtime Localization > > > > > > > > > > > XOML engine Xoml Type Info Workflow BAML engine XAML engine Presentation Framework.dll (PF.dll) PresentationCore.dll (PC.dll) XamlTypeInfo WindowsBase.dll Mscorlib, System, System.Xml 3.x BAML engine PF.dll PC.dll Windows Base.dll WPF WF, WCF, More… XAML XamlTypeInfo engine System.Xaml.dll Mscorlib, System, System.Xml > > > > > > > Object Member Value StartObject Canvas StartObject Button StartMember Children StartMember Value Background “Green” StartMember Value Content “OK” StartObject StartMember Value Button Content “Cancel”

>
>
>
>
>
>
>
Static
Analysis
Design
Time
Compile
Time
Runtime
Localization
>
>
>
>
>
>
>
>
>
>
>
XOML
engine
Xoml
Type
Info
Workflow
BAML
engine
XAML
engine
Presentation
Framework.dll (PF.dll)
PresentationCore.dll
(PC.dll)
XamlTypeInfo
WindowsBase.dll
Mscorlib, System, System.Xml
3.x
BAML engine
PF.dll
PC.dll
Windows
Base.dll
WPF
WF,
WCF,
More…
XAML
XamlTypeInfo
engine
System.Xaml.dll
Mscorlib, System,
System.Xml
4
>
>
>
>
>
>
>
Object
Member
Value
StartObject
Canvas
StartObject
Button
StartMember
Children
StartMember
Value
Background
“Green”
StartMember
Value
Content
“OK”
StartObject
StartMember
Value
Button
Content
“Cancel”
>>FUTURE
>
>
>
demo
>>FUTURE
>
>
>
>
>
>
>
>
>
>
<Style TargetType="Button" 1 >
<Setter Property="Background" 2
Value="Red" 3 />
</Style>
1) Type type = xamlTypeResolver.Resolve("Button");
2) Value of Style.TargetType determined by calling
IAmbientProvider to find instances of Style.TargetType up the
parse stack.
3)
xamlSchemaContext = ixscp.SchemaContext;
xamlType = xamlSchemaContext.GetXamlType(typeof(Button));
xamlMember = xamlType.GetMember("Background");
value=xamlMember.TypeConverter.ConverterInstance.ConvertFrom(…);
<Button Click=“foo” 1 />
<Button
2
Click=“{l:EventWire foo}” />
<Button Height=“{l:GetValue 3
tb1.Height}” />
1) Parser looks for foo method on Root object.
2) IRootObjectProvider can get root object.
3) IXamlNameResolver can find element with Name of tb1 (even it is
hasn’t been parsed yet).
>>FUTURE
>
>
1
2
>
>
>
>
4>
5>
>
6>
3
>
>
>
>
>
>
>
>
Note: Compilers + Designers in .NET 4, VS2010, & Blend won’t
have XAML2009 support at RTM.
>
>
>
>
>
>
>
>
>>FUTURE
>
>
>
>
>
>
>
>
>>FUTURE
>
>
>
>
>
>>FUTURE
>
>
>
>
>
announcing
>>FUTURE
StartObject
Canvas
StartMember
Children
StartObject
Button
StartObject
Button
StartMember
Background
Value
“Green”
StartMember
Content
Value
“OK”
StartMember
Content
XDObject
XDMember
Canvas
Children
Represents the XAML Node
stream in a tree
• XML nodes
(XmlReader ->
XDocument)
• XAML nodes
(S.X.XamlReader ->
XamlDom)
Value
“Cancel”
XDMember
Value
XDObject
Background
“Green”
Button
XDMember
Value
Content
“OK”
XDObject
XDMember
Value
Button
Content
“Cancel”
>>FUTURE
>
>
>
>
>
demo
<Button Background="Red">Click Me!</Button>
XamlXmlWriter xamlXmlWriter = new XamlXmlWriter("myfile.xaml",
schemaContext);
XamlType buttonType = schemaContext.GetXamlType(typeof(Button));
XamlMember backgroundMember = buttonType.GetMember("Background");
XamlMember contentMember = buttonType.GetMember("Content");
xamlXmlWriter.WriteStartObject(buttonType);
xamlXmlWriter.WriteStartMember(backgroundMember);
xamlXmlWriter.WriteValue("Red");
xamlXmlWriter.WriteEndMember();
xamlXmlWriter.WriteStartMember(contentMember);
xamlXmlWriter.WriteValue("Click Me!");
xamlXmlWriter.WriteEndMember();
xamlXmlWriter.WriteEndObject();
xamlXmlWriter.Close();
new XamlDomObject(typeof(Button), schemaContext,
new XamlDomMember("Background", "Red"),
new XamlDomMember("Content", "Click Me!")
);
XamlDomServices.Save(domObject, "myfile.xaml");
>>FUTURE
>
>
>
>
>
>
>
demo
public abstract class BaseXamlRule : BaseIntrospectionRule
{
public abstract void CheckXaml(XamlDomObject rootObjectNode,
XamlSchemaContext schemaContext,
string resourceName);
}
>>FUTURE
• Processes all XAML/BAML files in a
Resource and calls CheckXaml
• CTP supports WPF, Silverlight, and
Workflow
• Considering a visitor pattern as well
>>FUTURE
>
>
>
>
>>FUTURE
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>>FUTURE
>
>
> Based on System.Xaml Node stream
> Better validation
> Additional XAML Validation component that can be
used elsewhere (FxCop, Designers, localization, etc…)
> Improve generated files (.g.cs/.g.vb)
(XmlnsDefinitionAttribute,
RuntimeNameProperty, etc…)
> x:Property
> Add XAML2009 support for WPF
>
>
>
>
>
>
>
>
>
> Better incremental parse/update
> Better support for attached properties
>
>
>
>
>
>
Criteria
Impact on XAML
Cider/Blend Value Editing
Experience
Runtime Performance
x:Uid
Better
Better
{ME}
Poor
Poor
Better
Ok
(lite +
heavy)
Post-Build Localization enabled
Injection of Values
Yes
No* -> Yes
No
No
Support for RichText
Yes
No
Support for Element Reordering Yes
No
>
>
>
>
>
>
>
>
>>FUTURE
>
>
>
>
Support x:Uid based localization
>
>
>
Support x:Uid based localization
Support x:Uid based localization
>
Improve Pain Points
demo
>>FUTURE
>
>
>
>
>
>
>
>
>
>>FUTURE
>
>
>
>
>
>
>
>
>
>
>
>
channel9.msdn.com/learn
Built by Developers for Developers….
>
>
© 2009 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries.
The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market
conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT
MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.