master-detail with Windows Phone 7 listbox - windows-phone-7

I've got a very basic and common scenario I'm trying to work through in my WP7 silverlight application.
I have a basic listbox inside a panorama control that I'm databinding a collection of objects to. Right now i have a datatemplate that just renders a single textbox for every row.
I would like to implement some sort of master/detail strategy for this.
For example, my listbox is just a list of people
John
Bob
Bill
Mike
...
If I were to click on John, I want to pass an ID for that row into some type of subview that will show a simple form that would let me edit the details of that row (invoking some transition, of course)
How would I go about doing this?

The Windows Phone Databound Application project template can be used as a model for how to build this.
During the CTP the equivelant project template had a transition animation, but this one doesn't.
However you can implement the transition following either Christian Schormann's CL02 Mix 10 talk or Shawn Wildermuth's blog post.
Shawn Wildermuth - Bring Back Page Transitions to the Windows Phone List Application Template

Related

How to implement routing when I need swipeable view inside another view with Ionic Framework?

How can I implement ui-router when I make a swipeable view inside another view with Ionic Framework?
I need to make a calendar view, which will contain 3 parts:
Navigation bar (unchangeable)
Day details bar under the navigation bar it should not move while I swipe list (3) and it should display current day/date
Scrollable/Swipeable list of time slots available for selected day, this list should be swipeable back and forth to next/previous day and scrollable.
This is how I imagine myself how it should be:
Ok, I've done it much more simpler by using ion-slide-box to which I dynamically adding slides as explained here: How to insert data dynamically to ion-slide-box Angularjs Ionic.
Anyway, if somebody has another idea how can it be implemented please comment or post your answer, it's good to have few another solutions in a toolbox.

Store App Dashboard: GridView and Multiple Charts

I'm working on a Store app that consists of several charts. I've already developed the charts and have them rendering using the chart control in the various forms.
I have been asked to bring these together in an app that allows the user to scroll left and right through each of the charts.
Every example I have found for using a GridView data binds the content of the GridView to item templates.
What I'm trying to get my head round is how I could please these chart controls directly in to a GridView.
Any help would be greatly appreciated.
Cheers,
Roy
As per my understanding of the question you need to have charts as items in a grid view.
If this is what you want, I have dome this before using charts from 3rd party toolkit.
You need ( may be variable sized) templates with each item having a different template of its own.
You need a items list with data for all the charts.
Then upon runtime you need to assign the template to each item.

Updating Controls from Multiple Pages on Windows Phone

All, I am new to Windows 7 Phone. My situation is that I have a main page which contains a ScrollViewer which in turn houses a StackPanel. I want to populate this StackPanel with multiple sub-StackPanels (at runtime) which are to hold an Image Thumb nail a hyperlink and some basic information about the image.
This is all good when I do this from the main page, but I want to know how to update this control (which is on the main page), but from any page other than the main page. I would like to know what is considered best practice for updating a page's control (like that outlined above) from another page.
Obviously there are a number of ways to pass data between pages
PhoneApplicationService.Current.State["yourparam"] = param
NavigationService.Navigate(new Uri("/view/Page.xaml", UriKind.Relative));
then in other page simply
var k = PhoneApplicationService.Current.State["yourparam"];
and many others. But what is best practice for updating a generic control from a different page?
Note: There are many question about data access and passing between pages.
Passing data from page to page
How to pass the image value in one xaml page to another xaml page in windows phone 7?
Passing image from one page to another windows phone 7
and more. This is not what I am asking.
If I understand your question correctly, you are trying to update a control which is on for example MainPage.xaml from another page for example Page2.xaml.
As far as I know there is no way to reach a pages controls from another page, and that seems unnecessary for the cases that I can think of.
The method used to achieve what you are trying is usually done by triggering an action (like the press of a button ) and passing a parameter to the page you are trying to update the control. And on that page's onnavigatedto event (or viewmodel constructor if you are using the MVVM pattern), update your control based on the passed parameter.
If your update is based on data then the best practice is to bind an observable collection or an object that extends the INotifyPropertyChanged (basically any object that can signal that one of their property changed to the ui) and change the data based on the parameter that is passed.
If these two pages somehow are visible at the same time and there is no navigation needed between them( like a popup or sliding menu kind of ui) then you can make the page that you are showing in the popup a usercontrol, and reach to the parent's controls by this.Parent.
I can be more helpful if you give more specifics about your app's flow.
The MVVM pattern would be a good way to go. Saying MVVM is too complicated for small teams isn't exactly accurate - the purpose of MVVM is to decouple Silverlight or WPF code. Using the codebehind of a Silverlight page to directly access data creates coupling in your code and accrues technical debt. Whether you're one developer or 100, if your UI is coupled with your data classes, if you have to change your data classes, you will have to make changes to every UI element that uses those classes. This takes longer and makes your application more difficult to change.
MVVM makes it so your UI (the View) doesn't know anything about the data (your Model). The ViewModel is the code in between that the UI can bind to, and which manages events in the UI that need to be persisted to the Model, and also changes in the Model that need to be represented in the View. For this reason, it handles events, and that's what it sounds like you need in your code - an event that can exist off of the codebehind, that can update the Views bound to it when the data changes. If you have two pages, then an event on one of the pages will be sent to the ViewModel, which will make a change to the Model (data) if necessary, and pass it back to the ViewModel. The ViewModel would then update any of the UI elements (Views) bound to that piece of data.
There's a REALLY good demonstration of how to implement the MVVM design pattern here
. The guy goes through and takes a typical WPF application (just like Silverlight), where the UI codebehind implements event handlers that directly access data, and refactors it using the MVVM pattern.

UI Design of listboxes in windows phone 7?

in a page 4 menus one by one like the below.
APPS
1.sample1
2.sample2
PERSONAL
1.info1
2.info2
Valuble
1.item1
2.item2.
More
1.item1
2.item2
like the above APPS,PERSONAL,Valuble,More these are Headings.in that items are binding from Sqlite DB.
intially there are no items .DB is creating .by click on button in that page navigating to another page here i'm binding categories[APPS,PERSONAL---] to combobox and one textbox is there.in that way i'm adding items to mainpage.
functionalty is ok but i taken four listboxes statically placed in that i'm binding the items.but intially no items while db creation.if whenever adding the PERSONAL item first the first listbox was empty and filling the second listbox.if whenever adding MORE items first ,the above listboxes are empty this is bad design i think.
How to design UI for that...
I would have thought this is is an ideal candidate for the LongList selector control of Windows Phone - similar to the contacts page.
Have a look here http://www.windowsphonegeek.com/articles/wp7-longlistselector-in-depth--part1-visual-structure-and-api
I haven't used it myself but would think that you should be able to use it to get the effect you require.

How many view models for a panorama page

I'm starting to play with the windows phone 7 panorama control.
I looked at the panorama project template provided in visual studio and saw that the two panorama items use the same view model (and in fact the same data from the model).
How is it in real world applications? Should I best use one view model per panorama item or is it best practice to have only one view model for the complete panorama?
I think that is one View Model per page (a panorama is just a control, not multiple pages). So one ViewModel on a page and every PanoramaItem will use it (My opinion).
It depends on what you are doing.
In most cases I would have separate view models for each page, but if for instance each page is very simple then you may not need it.
An example could be a panorama with each page displaying an image. In this case you might get away with binding the the panorama control to a single list of images.
It really depends on the application. What you saw in the default template is simply there to show you the basics of a MVVM-based design. I personally use a ViewModel for a set of pages that have a similar purpose (e.g. managing media content). There is a single ViewModel locator (per application) that ties them all together.
Bottom line - it is more of a question of preference, as long as the concerns are separated.

Resources