Why prefer LongListSelector over Listbox in Windows Phone 8 - windows-phone-8

The question is in the title, why is LongListSelector preferred over Listbox, even for creating flat lists in Windows phone 8?

Even if you only want to display flat data, the LongListSelector is preferable because:
It provides an optional header and footer.
The performance of a LongListSelector is better than that of a ListBox.
The LongListSelector supports full data and UI virtualization.
See the msdn reference for further information.

Related

Custom controls in WP8

i would like to know if it's possible to define a new user control on the basis of the pre-defined ones in WP8. For example, if i wished to define a custom Application Bar (like the one in the Windows Phone Store) starting from the standard one, or a custom Context Menu, would it be possible?
Thanks
The simple answer is "yes." For instance, a vast majority of the controls in the Windows Phone Toolkit are derived from their base-level analogs, such as the most obvious example of PhoneTextBox.
Regarding ApplicationBar specifically, you will note the class is sealed and cannot be inherited, but you can create predefined templates in XAML for application bar configurations you wish to reuse. As a custom control, that specific construct does not make sense as it is a baked-in OS element. Instead, depending on your use case, it may be better to completely disable the ApplicationBar and create an entirely new control that implements the custom functionality you desire.
The controls are skinned using a convention in Windows Phone development by generating a Generic.xaml file in the Themes folder that is compiled as a library resource. One such example can be found at the link inside the Windows Phone Toolkit's WP8 library.

Windows store app custom gestures

I would like to teach my application (Windows Store application) to recognize custom gestures like triangles, ellipses, squares and etc. I found one article similar to what I'm looking for, but it's not for windows store applications. I'm curious if there is any api available to do this task or it should be implemented in a "Do It Yourself" manner?

Is WinRT Pivot control dynamic binding possible?

As the question says, can we bind items dynamically to a pivot control in WinRT? i.e. instead of static pivot items, I have varying number of pivot items. We could do this in WP 7.5/8. I want to port my app to WinRT and stuck with this. I can't find any example on the net. So any help is greatly appreciated.
Also, can we do it in WinJS?
I am currently doing that in WinJS using KnockoutJS, basically doing the bindings inside the WinJS control for each hub item.
Here's a nice walkthrough of the pivot on WinJS.
http://msdn.microsoft.com/en-us/library/windows/apps/dn615002.aspx

trying to load page with WinJS controls into IE 10.0

From VS2012, I right click on default.html page and choose to run this page in IE (10.0). Problem is that any WinJS controls that I have on the page aren't been displayed. I get a warning about Allowing ActiveX script where I allow to run the ActiveX script. Can windows 8 store app build with javascript should be able to run in IE 10.0?
WinJS is not meant to be a browser based application.
Windows Store apps are meant solely to be run in the WinRT environment.
If you explore WinJS, you'll see it calls into the Windows namespace which are the actual WinRT JavaScript projections - ie the translations from the C++ COM based API into in this case JavaScript.
So then the next question is what are you trying to accomplish? If you have a common code base to run in the browser, then don't have dependencies on WinJS or the built in style sheets.
Remember though,Windows Store apps have specific design recommendations that may not be the best for a browser based application, although thats your call.
If you post separately what you are trying to accomplish though to run in the browser and in your Windows Store app, we can try to help you make the best design decision.
Since that is a separate question than what's provided here, I'd say sign up for App Builder http://aka.ms/stackbuilder and check out the free design guidance you get from there, plus check my profile, I'm available for free time each week (oHours) and would be happy to go over this with you via skype, phone, etc
Unfortunately you can't, firstly due to licence of winjs (details here: http://social.msdn.microsoft.com/Forums/en-US/winappswithhtml5/thread/dbdabf29-206d-4d93-a491-b5e8fcd6a920/) and secondly because winjs is rather tightly coupled with winrt.
One alternative I found is http://www.bluesky.io/ which allows you to run winjs compatible code in browser. Not sure how it works in practice though.

Capture screen of Windows store App

Is it possible to capture the contents of running Windows store app? I need to capture the entire screen or a user defined rectangular area.
The application will provide share option
When the application is running and share option is selected, I want to get the screen shot periodically say 4 times in a second
This screen shot image will be posted to server, which will store the same
It's now possible in Windows 8.1 to capture the screen of a Store App. You need to use the RenderTargetBitmap class.
You can find an example here:
http://mariusbancila.ro/blog/2013/11/05/render-the-screen-of-a-windows-store-app-to-a-bitmap-in-windows-8-1/
Hope it helps.
You can't capture screen programatically. See the below threads from MSDN.
Programmatically take snap shot Windows RT.
How to capture screen in Metro app?
There is no built-in mechanism to render Windows 8 XAML UI to a bitmap in Windows 8.0. Depending on how complicated your UI is you could implement your own composition engine to render your UI to a bitmap using Direct2D or use the WinRT XAML Toolkit WriteableBitmap.Render() method implementation which has a limited support for doing what you ask (it doesn't render all types of controls, doesn't support RenderTransform, etc.). You could update it though to add support for the missing features.
Windows 8.1 APIs include the new 'RenderTargetBitmap' class that allows to render to a bitmap with its RenderAsync methods.