WP 8.1 Hub SectionsInViewChanged not firing for two sections - events

I have a hub control with two sections. I want to fire an event when the main section in view changes. In order to do that I use the SectionsInViewChanged event. However this does not fire when the user swipes to the next section (when there are only 2). When I add another section then it fires? Is there a different event which I should use?

MSFT recommends not to use Hub control with only two sections.
Tip: Two section Hubs don’t wrap. This is by design. Having a Hub with
fewer than three sections is not recommended UX and supporting
wrapping for two section Hubs was very expensive.
http://blogs.windows.com/buildingapps/2014/07/22/tips-and-tricks-for-using-xaml-controls-in-your-universal-windows-apps/

Related

Difference between pager and notifications

I am not really understanding what's the difference between using a notification to build a ui where you can perform an action (click on button or display a card) and using the GridViewPager to do that.
I am creating an app where you can perform actions with a button (following the spec of google, on action/button per page). I am using the GridViewPager to do so. But looking at the samples that google provides and looking at the different wear apps that I could find, it looks like a lot of the applications have the same design : buttons with a blue background circle, provided by the Notification class.
In which case should I use the GridViewPager or the notifications?

Multitouch (not gestures!) does not work on Windows Phone devices?

I read something about it, the standards controls (buttons, etc) do not support multitouch, you can only use one control at a time.
I need to use two sliders or drag drops at the same time, among other things, any idea how to do this? I actually have to create the 0?
How to work with Touch.FrameReported? It works equally DeltaManipulation?
Controls on the phone have the concept of focus. Only one control can have focus at a time. Some controls support multi-touch interaction some do not. It is not posisble to interact with multiple controls at the same time.
If you need to allow the user to manipulate multiple controls at the same time you will have to create your own, new, control which mimics this behavior.

ListPicker separate templates for Normal and Expanded states

Is is possible to either subscribe to a ModeChanged event or to have a separate template for the Normal and Expanded states of the ListPicker control.
I am specifically looking for a way to have my text wrapped when the ListPicker is expanded (not full-screen) and not wrapped when the ListPicker is in the Normal state.
I am using this in a Windows Phone 7.1 targeted application and the GotFocus, LostFocus, and Tap events are not being fired. Right now, the only event I can look at is the SizeChanged event to look at switching templates by looking at the ListPickerMode status.
The ListPicker supports 2 separate templates, one for each scenario.
Use ItemTemplate for the expanded view.
Use FullModeItemTemplate for the full page view.

Expression Blend VSM vs Event Driven

I recently used Expression Blend and I found that it has something called Visual State Manager, what is the difference between it and the regular event driven model, and which is better?
Events are for instances of "things" happening e.g.:
Was I clicked?
Did my timer fire?
Is my data ready?
The Visual State Manager is used to manage multiple simultaneous states of a control.
Am I pressed?
Is the mouse over me?
Am I checked?
Events are just callbacks to listening objects, while states are visual states, so basically there are used for completely different purposes. Events can trigger state changes, but that is the only overlap.
An object fires an event to indicate that something has occurred. The event carries an arbitrary payload (the event args) plus (by convention) the object which sent the event. Visual states define the different states of a control or user control. A visual state defines how a control looks, how it transitions to that look, and how it transitions away from that look. ("Transition" can involve anything from toggling the visibility all the way though a complicated animation.) Visual states are part of a control, but you can't directly subscribe to them as you can with events.
One model is not better than the other: they're simply different. Think of using events in your view model and model/service layers and visual states in your view layer.
Visual State manager is used for managing state (surprisingly). So for example your button can be in multiple sates:
Mouse over
Mouse down
Disabled
Enabled
You code doesn't really need to know about it, so all visual states of your application should be kept within XAML.
Also Visual state managers helps to reduce your code behind which is more error prone.
And as for events, in fact I tend to use commands more often now, I find them to be more useful than events on its own.

How to create a tab control where every tab item is connected with a different listbox

How can we create a tab control where every tab item is connected with a different listbox, so the view are different for every tab? I want to know what is the best solution for this, I tried two approaches:
All logic of tab activity is built in one class that is
mainPage.xaml.cs
For every tab I create a new class and call it when a tab event
fires
What is the best solution and if answer is second then what is procedure to add different view but the all the tab appear every time?
Or provide a link where I can get a full example of tab control usage in Windows Phone 7.
Windows Phone does not provide a TabControl implementation, however, it does provide the unique Pivot control, which provides the same level of functionality and is documented on MSDN. You might also find this post by Jeff Wilcox useful: http://www.jeff.wilcox.name/2010/08/looking-ahead-at-panorama-and-pivot/
Here is an article I wrote on how to use the TabControl in a Windows Phone Silverlight application. It does not really abide the current UI guidelines, but it works. All you need to do is use ListBox controls as proper child elements.

Resources