Академический Документы
Профессиональный Документы
Культура Документы
Prerequisites
This topic assumes that you have read the XAML Overview (WPF) and have some basic knowledge of the CLR and objectoriented programming.
12/19/13
For the Microsoft Visual Basic language specifically, you can use the language-specific Handles keyword to associate handlers with instances and events in the handler declaration, instead of attaching handlers with attributes in XAML. However, this technique does have some limitations because the Handles keyword cannot support all of the specific features of the WPF event system, such as certain routed event scenarios or attached events. For details, see Visual Basic and WPF Event Handling.
x:Code
x:Code is a directive element defined in XAML. An x:Code directive element can contain inline programming code. The code that is defined inline can interact with the XAML on the same page. The following example illustrates inline C# code. Notice that the code is inside the x:Code element and that the code must be surrounded by <CDATA[...]]> to escape the contents for XML, so that a XAML processor (interpreting either the XAML schema or the WPF schema) will not try to interpret the contents literally as XML. XAML < P a g e x m l n s = " h t t p : / / s c h e m a s . m i c r o s o f t . c o m / w i n f x / 2 0 0 6 / x a m l / p r e s e n t a t i o n " x m l n s : x = " h t t p : / / s c h e m a s . m i c r o s o f t . c o m / w i n f x / 2 0 0 6 / x a m l " x : C l a s s = " M y N a m e s p a c e . M y C a n v a s C o d e I n l i n e " > < B u t t o nN a m e = " b u t t o n 1 "C l i c k = " C l i c k e d " > C l i c kM e ! < / B u t t o n > < x : C o d e > < ! [ C D A T A [ v o i dC l i c k e d ( o b j e c ts e n d e r ,R o u t e d E v e n t A r g se ) { b u t t o n 1 . C o n t e n t=" H e l l oW o r l d " ; } ] ] > < / x : C o d e > < / P a g e >
See Also
Reference
x:Code Intrinsic XAML Type
Concepts
msdn.microsoft.com/en-us/library/aa970568(d=printer,v=vs.110).aspx
2/3
12/19/13
XAML Overview (WPF) Building a WPF Application (WPF) XAML Syntax In Detail
msdn.microsoft.com/en-us/library/aa970568(d=printer,v=vs.110).aspx
3/3