[Tech - Software Blog]
Windows 8 Metro Programming: WPF, Silverlight, XAML, C++ WinRT or COM???
if you've read this:
Windows 8 and untimely death of Silverlight and WPF… Again!
... was unveiling of Windows 8 Metro UI touch centric interface and statement that it was built using HTML5 and JavaScript. There was no mention of WPF or Silverlight or ...
you might think
They've Killing Off Silverlight and XAML?!
There seems to be a lot of mixed signals about what members of Microsoft's bag of tricks is going to killed off since strategically they are going to Html5 instead of add-ins like Flash or Silverlight. Is this the same sort of routine that as soon as you get used to one generation of MS tools, they spring another one on you? (VB6 C++ MFC ASP classic -> VB.NET C# ASP.NET -> WPF Silverlight)
Summary:
- Microsoft is backing down on Silverlight as a browser add-in
- Microsoft is promoting HTML5 which doesn't need add-ins for flash-like effects
BUT there is plenty else going on....
=======================================
Evolution of Microsoft Development Languages
So Windows 8 Metro builds on the technology in COM, .NET, C#, C++, WPF and Silverlight, so if you've been onboard the Microsoft evolution of tools from
Evolution of Microsoft Software
MS-BASIC C
C / Win16 / Win32 SDK
Visual Basic/C++ MFC/ASP
C# C++/CLI VB.NET ASP.NET
Here is the chart Microsoft has made of the various ways to make Metro or desktop apps
Metro Style App Samples are HERE:
http://msdn.microsoft.com/en-us/library/windows/apps/br211380(v=VS.85).aspx
================================================================
http://msdn.microsoft.com/en-us/library/windows/apps/br211385.aspx
Building your first Windows Metro style app using JavaScript
=================================================================
http://msdn.microsoft.com/en-us/library/windows/apps/br229583
http://code.msdn.microsoft.com/windowsapps
some of the top ones:
Update!! I found these great pluralsight tutorials, but you have to do the 10 day trial, and then pay after that
Basically,Windows 8 Metro looks like Windows Phone 7 which looks like Silverlight which looks like a Webform which looks like....
VISUAL BASIC,
which is GREAT.
That means you drag OBJECT onto the form, do the event OBJECT.BUTTON_CLICK code OBJECT2.text = whatever on the .cs page, and with WPF relationships you may be able to wire it up so you don't even need code, and run it. Beautiful.
WinRT is the way for C++ to talk to windows instead of going through all the .NET classes, which is great for "native code", it uses the ^ hat operator somewhat like the "managed C++" for reference counted objects from COM, which is another blast from the past that's not quite dead yet. You can still do c#, but if you want to fast graphics, you have to do Direct-X in C++, like the Windows Phone choice you have between silverlight menus and buttons and drawing 3D games in XNA. If they are doing Html5, it's going to be hidden under the Visual Studio XAML stuff.
Some good comments on C++/CX as how .NET could have been done without needing C#:
http://stackoverflow.com/questions/7418400/windows-8-c-and-metro-gui-samples
Here is info on C++/CX
http://blogs.msdn.com/b/vcblog/archive/2011/10/20/10228473.aspx
devcomponents.com/blog/?p=973 - Cached
Not Quite Dead Yet
Other indications is that Metro apps will very much leverage the programming models in the wpf / silverlight / xaml / mvvm mode of applications:
This fellows asks: Can you port windows phone 7 to windows 8?
http://stackoverflow.com/questions/7429283/how-easy-is-it-to-port-a-windows-phone-7-application-to-metro-on-a-windows-8-tab
and the reply is though it probably won't work as one code set, but:
•both use XAML
•both can use the same programming language for the code (probably C#)
•the design of "metro style" apps on Win8 was INSPIRED by Metro (the design language of WP7)
Here is another article that says Metro will be the next frontier for xaml and silverlight programmers:
silverlight and xaml skills will carry over to windows 8
http://visualstudiomagazine.com/articles/2011/11/01/silverlight-skills-carry-over-to-windows-8-metro-style-apps.aspx
Path for XAML Developers
What about developing for Windows 8 with XAML, which was recently unveiled at the Microsoft BUILD conference in September? Windows 8 is an early preview but has enough of its shape to show XAML developers that their skills are indeed very applicable. Is it perfect or whole? Of course not, it's a preview. But the key is that there's a path for XAML developers, and it's a good path.
On the coding side, there's a path for developers to write with C# and Visual Basic using many of the APIs that they're familiar with in the new Windows Runtime (WinRT). The Visual Studio 11 Developer Preview now has more features, including a ton of the ones that were formally only included in Expression Blend. Of course, XAML is still XAML, the intrinsic controls haven't changed much, and there are even some new controls that pertain specifically to Windows 8 Metro apps (GridView and FlipView, for example). The bottom line is that it won't take long for any XAML-based developer to get up to speed on Windows 8 Metro apps. There are new aspects to learn, too, like integration with Windows 8 and its new features such as charms, settings and search. But these are really just new APIs that can be learned and integrated into Metro apps.So, if you're skilled at developing with Silverlight, WPF and Windows Phone, then you already have a leg up on learning to build Metro apps with XAML.
WinRT and the Return of Com
http://www.codeproject.com/KB/cpp/WinRTVisualCppIntro.aspx
Here is another article which compares winrt to silverlight and wpf:
http://stackoverflow.com/questions/7416826/how-does-the-new-windows-8-runtime-winrt-compare-to-silverlight-and-wpf
Here is an answer to a question that states that you get a real drawing api only through directx using C++ for metro apps. You can't go through gdi anymore, which is what win32 used internally to draw dialog boxes/ forms. Otherwise you get whatever boxes and paths you can do with xaml I would assume.
drawing api only direct x through c++ on metro style apps.
Drawing API in Windows Runtime?
http://social.msdn.microsoft.com/Forums/en-US/winappswithcsharp/thread/f7e0e525-831f-441d-b9bc-cf2928703e66
At present procedural drawing in Metro is C++ only, via DirectX.
Also note that this applies only to Windows Runtime, i.e. Metro touch-centric apps, not to regular desktop apps. The full CLR and BCL are present on the desktop, with Windows Forms and WPF and Silverlight. Just to clarify since there seems some confusion here
Direct2D is a good GDI replacement but used with C++ for Metro style apps. This C# sample sample covers drawing shapes and gradients, but does not go beyond display some basic shapes (from xaml):
http://code.msdn.microsoft.com/windowsapps/Drawing-bfc39296
http://code.msdn.microsoft.com/windowsapps/Windows-Developer-Preview-6b53adbb
Free Training - in the phillipines
This sounds like a great idea if somebody on this side of the pacific wanted to do a seminar like this. Microsoft was sponsoring workshops on doing windows phone 7 apps with silverlight, it might be good to jump start Windows 8 metro with seminars like this too. If somebody had the tech to A/V a stream of this I'd pay $5-25 to see the series.
http://www.wiztechie.com/2011/11/free-training-in-developing-metro-style-application-on-windows-8-using-html-5-javascript-and-css3/
Session 1 – HTML 5
Allan Spartacus Mangune, Microsoft MVP ASP .Net
Session 2 – Javascript and HTML 5
Mark Guitierez, Professional Developer
Session 3 – CSS 3 and HTML 5
Christopher Misola, Mobile Developer
In this workshop, we’ll provide the attendees with a preview on how to take advantage of the power of HTML 5, JavaScript and CSS 3 to develop Metro style applications on Windows 8.
Windows 8 Metro Programming: WPF, Silverlight, XAML, C++ WinRT or COM???
if you've read this:
Windows 8 and untimely death of Silverlight and WPF… Again!
... was unveiling of Windows 8 Metro UI touch centric interface and statement that it was built using HTML5 and JavaScript. There was no mention of WPF or Silverlight or ...
you might think
They've Killing Off Silverlight and XAML?!
There seems to be a lot of mixed signals about what members of Microsoft's bag of tricks is going to killed off since strategically they are going to Html5 instead of add-ins like Flash or Silverlight. Is this the same sort of routine that as soon as you get used to one generation of MS tools, they spring another one on you? (VB6 C++ MFC ASP classic -> VB.NET C# ASP.NET -> WPF Silverlight)
Summary:
- Microsoft is backing down on Silverlight as a browser add-in
- Microsoft is promoting HTML5 which doesn't need add-ins for flash-like effects
BUT there is plenty else going on....
- Metro apps are based on XAML, which are used widely by Silverlight and Windows Phone 7 forms. It is essentially a runtime-readable source code for what was compiled in Win32 and .NET dialog box/winforms and ASP.NET code on the web.
- Metro apps in XAML will be programmed very much like Silverlight which is like WPF which is like C# WinForms and ASP.NETwebforms which are like ... the old Visual Basic we know and love.
- WinRT is a COM-based alternative to the old Win32 and .NET classes that can be called by C++ native code (see CX variant below). You could call into Win32 from managed C# but it required some nasty "interop" madness. See channel 9 talk below. COM was supposed to be dead and replaced by .NET, but it has a new life now as a reference-count alternative to .NET everything.
- C++ with Component Extensions = C++/CX builds on the managed C++/CLI syntax for COM-based objects so you can do native code apps.
- C++/CX is the way to talk directly to DirectX for high performance graphics (as opposed to forms with code-behinds and data linkages)
- ABI allows talking to either C++, any of the managed .NET languages, or JavaSscript: You can write applications in Javascript/HTML/CSS and call APIs that you write in C++ or C#/VB from those JavaScript applicationsOne of the primary features of the new model is the abstract binary interface, or ABI, which defines an interface for inter-language communication. In Windows Developer Preview, native C++ can communicate across the ABI with JavaScript and with the managed .NET languages C# and Visual Basic.
- See this talk: channel9.msdn.com/Events/BUILD/BUILD2011/TOOL-531T for more information. The link should go live sometime on 9/15/2011 –
Downloads -
- MP4(iPod, Zune HD)
- Mid Quality WMV(Lo-band, Mobile)
- High Quality WMV(PC, Xbox, MCE)
- Using the Windows Runtime from C# and Visual Basic
- Windows has always provided compelling capabilities for developers to build upon
- [Shape]
- Windows has not always made it straightforward for you to use these capabilities from C# or VB
- The C# code you have to write today…
- [Shape]
- [DllImport("avicap32.dll", EntryPoint="capCreateCaptureWindow")]
static extern int capCreateCaptureWindow(
string lpszWindowName, int dwStyle,
int X, int Y, int nWidth, int nHeight,
int hwndParent, int nID);
[DllImport("avicap32.dll")]
static extern bool capGetDriverDescription(
int wDriverIndex,
[MarshalAs(UnmanagedType.LPTStr)] ref string lpszName,
int cbName,
[MarshalAs(UnmanagedType.LPTStr)] ref string lpszVer,
int cbVer);
// more and more of the same
- The C# code you get to write on Windows 8
- [Shape]
- using Windows.Media.Capture;
var ui = new CameraCaptureUI();
ui.PhotoSettings.CroppedAspectRatio = new Size(4, 3);
var file = await ui.CaptureFileAsync(CameraCaptureUIMode.Photo);
if (file != null)
{
var bitmap = new BitmapImage() ; - bitmap.SetSource(await file.OpenAsync(FileAccessMode.Read));
- Photo.Source = bitmap;
- For more information
- [Group]
- [Shape]
- [Shape]
- PLAT-874T: Lap around the Windows Runtime
- TOOL-930C: A .NET developer's view of Windows 8 app development
- TOOL-810T: Async made simple in Windows 8, with C# and Visual Basic
- APP-737T: Metro style apps using XAML: what you need to know
- TOOL-532T: Using the Windows Runtime from C++
- TOOL-533T: Using the Windows Runtime from JavaScript
- PLAT-875T: Windows Runtime internals: understanding "Hello World"
- PLAT-876T: Lessons learned designing the Windows Runtime
- [Shape]
- Related sessions
- [Group]
- [Shape]
- [Shape]
- Tour of the IDE for C#, C++ and Visual Basic Developers [http://go.microsoft.com/fwlink/?LinkID=227277]
- Building your first Windows Metro style app with C++, C# or Visual Basic [http://go.microsoft.com/fwlink/?LinkID=227459]
- Roadmap for creating Metro style apps in C#, C++ and Visual Basic [http://go.microsoft.com/fwlink/?LinkID=227201]
- [Shape]
=======================================
Evolution of Microsoft Development Languages
So Windows 8 Metro builds on the technology in COM, .NET, C#, C++, WPF and Silverlight, so if you've been onboard the Microsoft evolution of tools from
Evolution of Microsoft Software
MS-BASIC C
- Programming for DOS and early microcomputers. No programming SDK at all for C, only primitive CGA for GW-BASIC.
C / Win16 / Win32 SDK
- Program to Windows event loop and Dialog Box Editor. Forms are compiled and linked and cannot be interpreted at run-time. Windows SDK is tailored to the C language.
Visual Basic/C++ MFC/ASP
- Visual Basic for rapid development of forms,weak for big, fast powerful system software. Use VBX written in C++ for heavy duty coding. You can bring up database with forms in hours.
- C++/MFC for powerful development in native code. MFC maps form controls to run-time variables. Takes days to set up database with UI.
- Classic ASP for web based forms, use COM for heavy duty programming
- There are essentially 3 completely different ways to program, C++/MFC for industrial strength apps and special-purpose objects to call from Visual Basic or ASP, Visual Basic for rapid development, and ASP for browser based forms.
C# C++/CLI VB.NET ASP.NET
- Winforms for Windows Client resembles Visual Basic but can be programmed for C#, C++ or VB.NET. Form object names are also used for coding events and object properties. This unifies power of C++ (programs that fall apart easily when scaled up) with rapid development model of Visual Basic (much simpler than SDK or MFC)
- Webforms for ASP.NET also resembles Visual Basic, form object names are also used for coding events and object properties, but uses ASPX format for forms This further unifies development by extending Visual Basic model to the web.
- You have to use nasty "interop" to talk directly to Win32 which is not designed to be used from .NET but native C. Many function available from .NET classes, but not all win32 functions (like wifi) were exposed. I did a wifi project that was NASTY to figure out how to unpack structs into format .NET can use.
WPF / Silverlight / XAML / Windows Phone 7
- XAML is XML based form that can be interpreted at run-time to create either windows client form or html-based web form.
- XAML can be used for either Web or Windows client forms or in Silverlight add-in.
- WPF introduces dependency links for MVVM model without adding code to move data from database into form objects and back.
- Windows Phone 7 is based on Silverlight for form-based applications
- Windows Phone 7 is based on XNA (Direct X) for graphics-intensive games.
Here is the chart Microsoft has made of the various ways to make Metro or desktop apps
Metro Style App Samples are HERE:
http://msdn.microsoft.com/en-us/library/windows/apps/br211380(v=VS.85).aspx
Building your first Windows Metro style app using C#, C++, or Visual Basic
================================================================
http://msdn.microsoft.com/en-us/library/windows/apps/br211385.aspx
Building your first Windows Metro style app using JavaScript
=================================================================
http://msdn.microsoft.com/en-us/library/windows/apps/br229583
Roadmap for creating Metro style apps using C#, C++, or Visual Basic
http://code.msdn.microsoft.com/windowsapps
some of the top ones:
220 results
Distributed By Microsoft (Official Windows SDK Sample)
This sample pack includes all the Metro style app code examples developed for Windows 8 Developer Preview. The sample pack provides a convenient way to download all the samples at once.
|
9/14/2011
43,338 Downloads
(47)
|
Distributed By Microsoft (Official Windows SDK Sample)
This sample demonstrates how to use the app bar to present navigation, commands, and tools to users. The app bar is hidden by default and appears when users swipe a finger from the top or bottom edge of the screen. It covers the content of the applic...
|
9/14/2011
17,230 Downloads
(12)
|
Distributed By Microsoft (Official Windows SDK Sample)
This sample shows how to customize the transition from splash screen to app.
|
9/14/2011
5,384 Downloads
(3)
|
Distributed By Microsoft (Official Windows SDK Sample)
This sample demonstrates a basic end-to-end model for a simple first person 3D game using DirectX (Direct3D 11.1, Direct2D, and DirectWrite) in a Metro style C++ app.
|
9/14/2011
4,967 Downloads
(8)
|
Distributed By Microsoft (Official Windows SDK Sample)
This sample shows how to create, read, write to, copy or delete a file, how to retrieve file properties, and how to add a file to the most recently used (MRU) list and then retrieve the file from the list.
|
9/14/2011
6,604 Downloads
(4)
|
Distributed By Microsoft (Official Windows SDK Sample)
This sample demonstrates how to use the basic controls.
|
9/14/2011
3,187 Downloads
(4)
|
Distributed By Microsoft (Official Windows SDK Sample)
This sample demonstrates how to use the FlipView control.
|
9/14/2011
3,440 Downloads
(1)
|
Distributed By Microsoft (Official Windows SDK Sample)
This sample demonstrates how to create a Metro style device app for camera. A Metro style device app is provided by an IHV or OEM to differentiate the capture experience for a particular camera. It can be used to adjust camera settings or to provide ...
|
9/14/2011
2,475 Downloads
(2)
|
Distributed By Microsoft (Official Windows SDK Sample)
This sample demonstrates advanced functionality for creating and sending tile notifications.
|
Update!! I found these great pluralsight tutorials, but you have to do the 10 day trial, and then pay after that
Course | Author | Level | Duration | Released |
---|---|---|---|---|
Building Windows 8 Metro Apps with C# and XAML | Ian Griffiths | Intermediate | [04:44:41] | 10/17/2011 |
Building Windows 8 Metro Apps with C++ and XAML | Kate Gregory | Intermediate | [03:46:58] | 10/18/2011 |
Introduction to Building Windows 8 Metro Applications | Wahlin, Papa | Beginner |
Basically,Windows 8 Metro looks like Windows Phone 7 which looks like Silverlight which looks like a Webform which looks like....
VISUAL BASIC,
which is GREAT.
That means you drag OBJECT onto the form, do the event OBJECT.BUTTON_CLICK code OBJECT2.text = whatever on the .cs page, and with WPF relationships you may be able to wire it up so you don't even need code, and run it. Beautiful.
WinRT is the way for C++ to talk to windows instead of going through all the .NET classes, which is great for "native code", it uses the ^ hat operator somewhat like the "managed C++" for reference counted objects from COM, which is another blast from the past that's not quite dead yet. You can still do c#, but if you want to fast graphics, you have to do Direct-X in C++, like the Windows Phone choice you have between silverlight menus and buttons and drawing 3D games in XNA. If they are doing Html5, it's going to be hidden under the Visual Studio XAML stuff.
Some good comments on C++/CX as how .NET could have been done without needing C#:
http://stackoverflow.com/questions/7418400/windows-8-c-and-metro-gui-samples
you dont need to use P/Invoke to go from .Net to C++. From Documentation " One of the primary features of the new model is the abstract binary interface, or ABI, which defines an interface for inter-language communication. In Windows Developer Preview, native C++ can communicate across the ABI with JavaScript and with the managed .NET languages C# and Visual Basic." – Tinku Sep 15 at 13:24
@Pavel Minaev - exactly. After looking at the documentation and being angry for a moment at the fact that essentially using C++/CLI will be required to write native WinRT apps, I came to the conclusion that that iswhat .NET could have looked like from the beginning and in this world C# would be completely unnecessary. You can now write cross-platform native code by simply not using the WinRT components and objects. You don't have to change the language completely for that (and don't get me started on Mono begin cross-platform and all - try KeePass2 on OS X). I'm warming up to the idea.
| |||
|
Here is info on C++/CX
http://blogs.msdn.com/b/vcblog/archive/2011/10/20/10228473.aspx
Inside the C++/CX Design
20 Oct 2011 9:58 PM
devcomponents.com/blog/?p=973 - Cached
Not Quite Dead Yet
Other indications is that Metro apps will very much leverage the programming models in the wpf / silverlight / xaml / mvvm mode of applications:
This fellows asks: Can you port windows phone 7 to windows 8?
http://stackoverflow.com/questions/7429283/how-easy-is-it-to-port-a-windows-phone-7-application-to-metro-on-a-windows-8-tab
and the reply is though it probably won't work as one code set, but:
•both use XAML
•both can use the same programming language for the code (probably C#)
•the design of "metro style" apps on Win8 was INSPIRED by Metro (the design language of WP7)
Here is another article that says Metro will be the next frontier for xaml and silverlight programmers:
silverlight and xaml skills will carry over to windows 8
http://visualstudiomagazine.com/articles/2011/11/01/silverlight-skills-carry-over-to-windows-8-metro-style-apps.aspx
Path for XAML Developers
What about developing for Windows 8 with XAML, which was recently unveiled at the Microsoft BUILD conference in September? Windows 8 is an early preview but has enough of its shape to show XAML developers that their skills are indeed very applicable. Is it perfect or whole? Of course not, it's a preview. But the key is that there's a path for XAML developers, and it's a good path.
On the coding side, there's a path for developers to write with C# and Visual Basic using many of the APIs that they're familiar with in the new Windows Runtime (WinRT). The Visual Studio 11 Developer Preview now has more features, including a ton of the ones that were formally only included in Expression Blend. Of course, XAML is still XAML, the intrinsic controls haven't changed much, and there are even some new controls that pertain specifically to Windows 8 Metro apps (GridView and FlipView, for example). The bottom line is that it won't take long for any XAML-based developer to get up to speed on Windows 8 Metro apps. There are new aspects to learn, too, like integration with Windows 8 and its new features such as charms, settings and search. But these are really just new APIs that can be learned and integrated into Metro apps.So, if you're skilled at developing with Silverlight, WPF and Windows Phone, then you already have a leg up on learning to build Metro apps with XAML.
WinRT and the Return of Com
Some are complaining that like Silverlight, there isn't a way to do win32-style GDI calls, but seems they are splitting things up like on Windows Phone 7. There you have a choice of silverlight for fancy UI forms, or using C++ with XNA / DirectX / Opengl for wizzy 2d or 3d games. Somebody please explain in comments what is going on if you understand the grand plan.
This article explains that winrt is com-based native for C++, and they have tweaked C++ managed (which was pretty nasty last time I saw it for a bunch of ugly hacks to change to managed .net objects and native win32 structs) to talk to COM objects, which is nice for DirectX graphics since that was also com based. COM was supposed to be dead, replaced by java-inspired .net, but it is still best for native win32 or wrapping win32.http://www.codeproject.com/KB/cpp/WinRTVisualCppIntro.aspx
Here is another article which compares winrt to silverlight and wpf:
http://stackoverflow.com/questions/7416826/how-does-the-new-windows-8-runtime-winrt-compare-to-silverlight-and-wpf
Here is an answer to a question that states that you get a real drawing api only through directx using C++ for metro apps. You can't go through gdi anymore, which is what win32 used internally to draw dialog boxes/ forms. Otherwise you get whatever boxes and paths you can do with xaml I would assume.
drawing api only direct x through c++ on metro style apps.
Drawing API in Windows Runtime?
http://social.msdn.microsoft.com/Forums/en-US/winappswithcsharp/thread/f7e0e525-831f-441d-b9bc-cf2928703e66
At present procedural drawing in Metro is C++ only, via DirectX.
Also note that this applies only to Windows Runtime, i.e. Metro touch-centric apps, not to regular desktop apps. The full CLR and BCL are present on the desktop, with Windows Forms and WPF and Silverlight. Just to clarify since there seems some confusion here
Direct2D is a good GDI replacement but used with C++ for Metro style apps. This C# sample sample covers drawing shapes and gradients, but does not go beyond display some basic shapes (from xaml):
http://code.msdn.microsoft.com/windowsapps/Drawing-bfc39296
Windows 8 Developer Preview Code Samples
The samples are here, but I haven't looked at the code yet.http://code.msdn.microsoft.com/windowsapps/Windows-Developer-Preview-6b53adbb
Free Training - in the phillipines
This sounds like a great idea if somebody on this side of the pacific wanted to do a seminar like this. Microsoft was sponsoring workshops on doing windows phone 7 apps with silverlight, it might be good to jump start Windows 8 metro with seminars like this too. If somebody had the tech to A/V a stream of this I'd pay $5-25 to see the series.
http://www.wiztechie.com/2011/11/free-training-in-developing-metro-style-application-on-windows-8-using-html-5-javascript-and-css3/
Session 1 – HTML 5
Allan Spartacus Mangune, Microsoft MVP ASP .Net
Session 2 – Javascript and HTML 5
Mark Guitierez, Professional Developer
Session 3 – CSS 3 and HTML 5
Christopher Misola, Mobile Developer
In this workshop, we’ll provide the attendees with a preview on how to take advantage of the power of HTML 5, JavaScript and CSS 3 to develop Metro style applications on Windows 8.