Extensible Application Markup Language
Extensible Application Markup Language (XAML/ˈzæməl/ⓘ) is a declarativeXML-based language developed by Microsoft for initializing structured values and objects. It is available under Microsoft's Open Specification Promise.[3]
XAML is used extensively in Windows Presentation Foundation (WPF), Silverlight, Workflow Foundation (WF), Windows UI Library (WinUI), Universal Windows Platform (UWP), and .NET Multi-platform App UI (.NET MAUI). In WPF and UWP, XAML is a user interface markup language to define UI elements, data binding, and events. In WF, however, XAML defines workflows.
XAML elements map directly to Common Language Runtime (CLR) object instances, while XAML attributes map to CLR properties and events on those objects.
Anything that is created or implemented in XAML can be expressed using a more traditional .NET language, such as C# or Visual Basic .NET. However, a key aspect of the technology is the reduced complexity needed for tools to process XAML, because it is based on XML.[4]
Technology
XAML originally stood for Extensible Avalon Markup Language, Avalon being the code-name for Windows Presentation Foundation (WPF).[5] Before the end of .NET Framework 3.0 development, however, Microsoft adopted XAML for Workflow Foundation (WF).[5]
In WPF, XAML describes visual user interfaces. WPF allows for the definition of both 2D and 3D objects, rotations, animations, and a variety of other effects and features. A XAML file can be compiled into a Binary Application Markup Language (BAML) file,[5][6] which may be inserted as a resource into a .NET Framework assembly. At run-time, the framework engine extracts the BAML file from assembly resources, parses it, and creates a corresponding WPF visual tree or workflow.
في سياقات سير العمل، يصف XAML منطقًا تصريحيًا قد يستغرق وقتًا طويلًا، مثل ذلك الذي تُنشئه أدوات نمذجة العمليات وأنظمة القواعد. كان يُطلق على تنسيق تسلسل سير العمل سابقًا اسم XOML، لتمييزه عن استخدام XAML في ترميز واجهة المستخدم، ولكن لم يعد هناك تمييز بينهما الآن. مع ذلك، لا يزال امتداد الملفات التي تحتوي على ترميز سير العمل هو ".xoml". [ 7 ]
يستخدم XAML طريقة محددة لتحديد المظهر والشعور تسمى القوالب ؛ وهي تختلف عن صيغة أوراق الأنماط المتتالية ، وهي أقرب إلى XBL . [ 8 ]
لإنشاء ملفات XAML، يمكن استخدام Microsoft Expression Blend أو Microsoft Visual Studio أو مصمم WF المرئي القابل للاستضافة أو XAMLPad. [ 9 ]
أمثلة
يوضح هذا المثال الخاص بـ Windows Presentation Foundation النص "Hello, world!" في حاوية XAML ذات المستوى الأعلى المسماة Canvas.
<Canvas xmlns= "http://schemas.microsoft.com/client/2010" xmlns:x= "http://schemas.microsoft.com/winfx/2006/xaml" > <TextBlock> مرحباً بالعالم! </ TextBlock> </Canvas>xmlns="http://schemas.microsoft.com/..."قد يلزم تغيير المخطط ( الجزء) ليعمل على بعض أجهزة الكمبيوتر. باستخدام مخطط توصي به مايكروسوفت، يمكن أيضًا استخدام المثال [ 10 ]
<Canvas xmlns= "http://schemas.microsoft.com/winfx/2006/xaml/presentation" > <TextBlock> مرحباً بالعالم! < /TextBlock> </Canvas>يُعدّ الاستخدام الأمثل للربط، بالإضافة إلى إنشاء عناصر مستخدم مخصصة حسب الحاجة، جزءًا أساسيًا من الاستفادة الكاملة من لغة XAML. ويمكن إجراء الربط على النحو التالي:
<TextBox x:Name= "txtInput" /> <TextBlock Text= "{Binding ElementName=txtInput,Path=Text}" />الاختلافات بين إصدارات XAML
توجد ثلاثة تطبيقات رئيسية لـ XAML من مايكروسوفت:
- Windows Presentation Foundation (WPF)، الذي كان متاحًا لأول مرة مع .NET Framework 3.0
- Silverlight 3 و 4، كانا متاحين لأول مرة لمتصفح Internet Explorer 6، وقد تم إيقاف دعمهما الآن.
- مكتبة واجهة مستخدم ويندوز (المعروفة سابقًا باسم UWP XAML وWinRT XAML)، تم إصدارها لأول مرة مع ويندوز 8 وويندوز سيرفر 2012 ، ولكنها متاحة الآن كجزء من حزمة تطوير تطبيقات ويندوز (Windows App SDK).
These versions have some differences in the parsing behavior.[11] Additionally, the Silverlight 4 XAML parser is not 100% backward-compatible with Silverlight 3 files. Silverlight 3 XAML files may be rejected or parsed differently by the Silverlight 4 parser.[12]
Besides Microsoft implementations, there is also OpenSilver (formerly known as CSHTML5), a contemporary web technology implementation.
XAML applications in web browsers
Historically, XAML based applications could be run in some web browsers, such as Internet Explorer and Firefox. This could be achieved through XBAP files created from WPF applications, or via the Silverlight browser plugin. However, both these methods are now unsupported on all major browsers due to their reliance on the discontinued NPAPI browser plugin interface.[13][14]
Lock-in concerns
In 2007, European Committee for Interoperable Systems (ECIS) – a coalition of mostly American software companies – accused Microsoft of attempting to hijack HTML and replace it with XAML, thus creating a vendor lock-in.[15][16] Jeremy Reimer, writing for Ars Technica described this comment as "the most egregious error" and added that XAML is unlikely to ever replace HTML.[16]
See also
References
- ↑"[MS-XAML] Xaml Object Mapping Specification 2006"(PDF). Microsoft. June 2008.
- ↑"Extensible Application Markup Language (XAML)". Microsoft. 12 March 2019.
- ↑Worthington, David. "Microsoft adds XAML to 'Open Specification' list – Software Development Times On The Web". Archived from the original on 2008-12-11. Retrieved 2021-04-06.
- ↑"XAML Syntax In Detail". Windows Presentation Foundation library. Microsoft. 12 August 2021 – via Microsoft Docs.
- 123Rob Relyea : January 2004 – Posts
- ↑unknown (2009-07-30). "What is BAML?". DOTNET Spider.
BAML means Binary Application Markup Language, which is a compiled version of the XAML. When you compile your XAML it creates the BAML file.
- ↑Andrew, Paul (25 January 2006). "xoml or xaml?". MSDN Community Archive. Microsoft. Archived from the original on November 28, 2020.
Workflow programs (or models) are saved in the XAML format which is common to Avalon for serializing .NET types as XML. Avalon XAML is all about UI and Workflow XAML is all about business process so there's quite a semantic difference. The XOML file extension looks to remain for Workflow models though the file format is XAML.
- ↑Guthrie, Scott (22 February 2008). "Silverlight Tutorial Part 7: Using Control Templates to Customize a Control's Look and Feel". ScottGu's Blog.
- ↑Avery, James; Holmes, Jim. "3.3 Writing XAML in XamlPad - Windows Developer Power Tools [Book]". www.oreilly.com. O'Reilly.
- ↑Microsoft XAML Overview page at XAML Overview (Root element and xmlns)
- ↑"XAML Processing Differences Between Silverlight Versions and WPF". Silverlight Archive. Microsoft. 17 November 2011 – via Microsoft Docs.
Silverlight includes a XAML parser that is part of the Silverlight core install. Silverlight uses different XAML parsers depending on whether your application targets Silverlight 3 or Silverlight 4. The two parsers exist side-by-side in Silverlight 4 for compatibility. In some cases, the XAML parsing behavior in Silverlight differs from the parsing behavior in Windows Presentation Foundation (WPF). WPF has its own XAML parser.
- ↑"XAML Processing Differences Between Silverlight Versions". Silverlight Archive. Microsoft. 17 November 2011 – via Microsoft Docs.
- ↑adegeo. "FAQ about XBAP supportability". learn.microsoft.com. Retrieved 2024-05-16.
- ↑nakarnam (2020-03-16). "Silverlight End of Support - Microsoft Lifecycle". learn.microsoft.com. Retrieved 2024-05-16.
- ↑ بير، ستان (28 يناير 2000). "مايكروسوفت تواجه رسومًا من الاتحاد الأوروبي على نظام التشغيل فيستا" . iTWire . تم الاطلاع عليه بتاريخ 22 أغسطس 2013 .
- 1 2 رايمر، جيريمي (26 يناير 2007). "رئيس اللجنة الأوروبية يتهم مايكروسوفت باختطاف الإنترنت" . آرس تكنيكا . كوندي ناست . تم الاطلاع عليه بتاريخ 22 أغسطس 2013 .
روابط خارجية
- مصطلحات .NET
- لغات الترميز التصريحية
- لغات البرمجة التصريحية
- لغات الترميز
- واجهات برمجة تطبيقات مايكروسوفت
- تقنية الوسائط المتعددة لنظام التشغيل مايكروسوفت ويندوز
- لغات ترميز واجهة المستخدم
- لغات ترميز الرسومات المتجهة
- المعايير القائمة على لغة XML
