Can a HTML/WinJS View use a user control built in XAML/C#? - xaml

I am hesitant to develop a Windows Phone app in the HTML/WinJS Universal App space because of the difficulty of building complex user controls. Before I go the XAML/C# route, I would like to find out if it is possible to use a user control built in XAML/C# inside of an HTML/WinJS view?
My initial feeling is that it is not possible due to XAML parsing not being available in the HTML space, but I am not certain that this is the case. Any thoughts?
Also, I am not interested in 3rd party solutions such as Xamerin. I am really trying to see if this is possible from a native approach.

No. The HTML and Xaml UI stacks in the Windows Runtime are separate and cannot be mixed. You can call non-UI C# or native Windows Runtime Components from JavaScript.
You can include HTML in a Xaml WebView, but there is no reverse hosting.
--Rob

Related

Reposistioning Icons in Windows Store apps

I'm using a set of icons inside my Windows Store App for some functionality, I want to code for rearranging according to user wish like how we see in Windows 8 Start Screen. I want guidance and some resources for it, Do you have any suggestions?
Check out JQuery's GridView. Like Nate said. There are apps in the store that demonstrates the gridview. See CodeShow app. It's made from Javascript though.

How to display a Windows 8 metro style tile within an app?

Windows 8 metro style app tiles are created based on pre-defined xml templates (found here).
Is there any way to hook up to Windows' rendering of the tile to allow a tile preview within an app?
In my app I would like to offer the user a subset of the tile templates listed in the above link and let the user customize the tile content. A live preview of the customized tile rendered within my app would greatly improve the user experience.
you should look into HubTile.
I don't know any free control's right now, but Telerik and Syncfusion have HubTile control
You can't get access to real Windows tile rendering, but you can simulate it since all templates are known. It is very unlikely that Microsoft would change the way tiles are rendered and even if they do you should be able to issue app update to keep up with Microsoft.

WinRt WebView control handling navigation within the control

I have a Metro app using a WebView control. I'm using NavigateToString to load a html file which may contain hyperlinks. What I then want to do is detect when one of these hyperlinks is selected and, instead of allowing navigation within the WebView control, to launch IE and view the page there instead.
Is this possible within the WinRT constraints, and if so, how?
So far, I've tried capturing the WebView_LoadCompleted() event, but although it does fire at the right time, I can't see any details about the URI from the NavigationEventArgs.
Unfortunately this isn't possible directly because WebView does not include events like Navigating (which were present in Windows Phone).
Luckily Nick Randolph (brilliant Windows Phone and Windows 8 developer) has created a workaround using script events. He's got a great write up on his blog:
http://nicksnettravels.builttoroam.com/post/2012/04/21/Limitations-of-the-WebView-in-Windows-8-Metro-Apps.aspx

Metro Style Apps: WinJS a must?

Yesterday I have started developing my first Metro style App using JavaScript.
I've used one of those templates in Visual Studio 2011. This project template comes with a bunch of generated code which relies heavily on WinJS. The whole structure reminds of the ASP.NET with its Views and corresponding Code Behind files. There is also a navigator.js file which is responsible for the navigation between the Views. The whole data resides in the data.js and can be retrieved using different functions.
I worked with backbone.js and I found its concepts like MVC structure and routing pretty cool. My question is basically if you can implement such a Metro style App using backbone.js?
Can I eliminate WinJS and just start from scratch? Should I try to integrate backbone.js into the current structure? What would it look like then? Are there any restrictions for using third party JavaScript frameworks? Should I leave the generated structure as it is?
What are the best practices and patterns developing Metro Style Apps with JavaScript?
Thanks
You can use any JavaScript framework you like within a Metro-style JavaScript application. See this related question about jQuery:
jQuery and Windows 8 JavaScript Metro Style Apps
The WinJS framework performs a couple of functions, the first is a set of non-UI APIs for managing and manipulating data, making service requests etc ... These are easily replaced with other JavaScript frameworks. The second is the UI layer, here you might struggle a bit. The WinJS UI has been designed to follow the Metro Design Language. If you replace it with your own UI layer (using jQuery UI for example) your application will just not look right.
Personally I would use WinJS for the UI layer and to integrate with the runtime (state persistance, app switching etc...), but use a more standard JavaScript library, such as Backbone or Knockout for the bulk of my code to ensure portability.
I use Knockout js and Require js for MVVM. For visual effects, I use jQuery.
My data-main looks like a bit this:
(function () {
"use strict";
var app = WinJS.Application;
app.onactivated = function (eventObject) {
require(["/scripts/knockout"], function(ko){
// My knockout viewModel and data binding goes here
});
};
app.start();
})();
If you prefer Backbone in stead, I guess the setup would be similar.

Screenflow based application in Adobe Flex/Flash

I'm searching for some code samples for my Flash application. The app is based on screen-flows , i.e each screen is defined with some visual elements with some buttons which have async events associated with them(consuming web services basically). The buttons also have functionality to go back and forth between screens and jump to any screen. I want to define all of the visual elements and the functionality of the events in a XML file. Thus the model, view and controller are all in the XML. Does any framework allow this like Pure MVC? Where can I find some examples of this kind of functionality that I want?
There's a Flash implementation of Heirarchical State Machines here, which mentions XML and Flow Control:
http://code.google.com/p/troyworks/
(Note: There's a very slick screencasting application called Screenflow which may lay claim on that particular term these days...)