×

Discussion Board

Results 1 to 3 of 3
  1. #1
    Registered User
    Join Date
    Nov 2011
    Posts
    2

    Drill down listbox with several detail views for windows phone

    Drill down listbox with several detail views for windows phone
    Other possible TITLES for this Discussion (Just in case I call it an apple and others call it an orange): Navigation with progressive horizontal pages - Navigation with hierarchical levels - Navigation with drill down

    I have been looking for this for a long time and I see several other developers looking for the same thing.

    What I REALLY need is an EXAMPLE 1 for Windows Phone, The EXAMPLE loads a local (PLIST) XML file [compose of a dictionary with array's and dictionary's inside of each other] which it uses to display a LISTBOX (Prefer a NAVIGATIONLIST from Example 3), It loads the Node KEY "Title" as the possible selection items, When you make your selection it looks for the Node KEY "View" if not found, it reloads the PAGE and displays the next level Node KEY "Title" value. Each Array can hold an uncertain number of dictionary's and each dictionary can hold an uncertain number of array's with the final level depending on the Node Key "View" value displaying a different detail view with an uncertain amount of items to display.

    *** Example of Levels (LOCATION): Country - State - County - Cities - Miami
    *** Example of Lists in a Level (CITIES): Miami - Seattle - Atlanta - New York - Las Vegas - Hollywood
    *** Example of items in detail view (CONTACT): First Name - Last Name - Email - Phone - Website

    *** Different approaches that I can think of: *****

    1 - A dynamic listbox which instantly updates - EXAMPLE 11 - EXAMPLE 10 - EXAMPLE 9

    2 - A navigationlist that navigate to other navigationlist and use global objects as datacontent - EXAMPLE 3 - EXAMPLE 8

    3 - A navigationlist that navigates to the SAME xaml page with a switch or if else statement decision setup - EXAMPLE 6 - EXAMPLE 7

    4 - Ofcourse any combination or all of the above

    *** Issues of interest: *****

    1 - How to handle multiple sources of data - like several XML files - EXAMPLE Countries.xml State.xml Cities.xml Services.xml

    2 - How to handle MULTIPLE LEVELS of an XML file with the SAME NODE string value "CHILDREN" look at XML EXAMPLE LAYOUT
    (the method to drill down the XML nodes - EXAMPLE 7 - switch or if else statements)

    3 - How to handle the drill down - if possible within the same PAGE or maybe a back and forth mechanism like PAGE 1 navigate to PAGE 2 than PAGE 2 navigate to PAGE 1
    or reload/refresh/dynamically change the listbox upon selection to the next node down or navigate to the same page

    4 - How to handle the drill down from a local XML file or from a remote (HTTP) XML file within the app during RUN TIME meaning start with either but while running the app being able to access a local or remote XML file to continue the DRILL DOWN - EXAMPLE:
    Load a local DATA.XML file which DRILLS DOWN by COUNTRY (USA), STATE (FLORIDA), CITY (MIAMI) nodes than on CITY maybe have a CALENDAR selection option that if selected
    Loads a remote CALENDAR.XML file which DRILLS DOWN by EVENTS (ANNUAL), NAMES OF OCCASION (THANKSGIVING), NAMES OF EVENTS (MACY PARADE), to a detail VIEW that GIVES the following information: NAME, DATE, LOCATION, COMMENTS

    **** XML EXAMPLE LAYOUT ***** Open Notepad - Paste XML EXAMPLE LAYOUT - Save AS extension ".XML" with encoding UTF-8 ***************************************

    <xml version="1.0"><dict><key>Rows</key><array><dict><key>Title</key><string>Country</string><key>Children</key><array><dict><key>Title</key><string>State</string><key>Children</key><array><dict><key>Title</key><string>County</string><key>Children</key><array><dict><key>Title</key><string>City</string><key>Children</key><array><dict><key>Title</key><string>Miami</string><key>View</key><string>1</string><key>Population</key><string>2 Million</string><key>Temperature</key><string>70</string><key>Radio Stations</key><string>15</string><key>Universities</key><string>13</string><key>Colleges</key><string>2</string></dict></array></dict></array></dict></array></dict></array></dict><dict><key>Title</key><string>City</string><key>Children</key><array><dict><key>Title</key><string>Miami</string><key>Children</key><array><dict><key>Title</key><string>Public Radio Stations</string><key>Children</key><array><dict><key>Title</key><string>Classic</string><key>View</key><string>6</string><key>Station</key><string>88.9 FM</string><key>CallSign</key><string>WDNA</string><key>Stream</key><string>http://war.str3am.com:7990</string></dict></array></dict></array></dict></array></dict><dict><key>Title</key><string>Information</string><key>Children</key><array><dict><key>Title</key><string>Airlines</string><key>Children</key><array><dict><key>Title</key><string>American Airlines</string><key>View</key><string>2</string><key>Reservations</key><string>800-433-7300</string><key>Customer Service</key><string>800-223-5436</string><key>Website</key><string>www.aa.com</string></dict></array></dict></array></dict></array></dict></xml>

    **** Example List: *****

    EXAMPLE 1 - EXACTLY what im looking for but on IOS, need this for the windows phone

    http://www.iphonesdkarticles.com/200...tail-view.html

    EXAMPLE 2 - How to handle a PLIST file in windows phone like a XML

    http://stackoverflow.com/questions/6...plist-document

    EXAMPLE 3 - NavigationList or Listbox possibility maybe not sure recommendations please for THIS PROJECT basis

    http://www.scottlogic.co.uk/blog/col...nlist-control/

    EXAMPLE 4 - Basic idea to what i need but needs to go several levels down but depending on selection a variety of levels down and with a variety of different detail views and hopefully reload the next level on the same page by refreshing the binding listbox (Navigationlist prefer)

    http://www.windowsphonegeek.com/arti...sitory-Pattern

    EXAMPLE 5 - reading a local xml file

    http://www.windowsphonegeek.com/tips...nd-databinding

    EXAMPLE 6 - being to reload the same xaml page to refresh the binding listbox with the next level down child node from the xml

    http://blogs.ugidotnet.org/corrado/a...s-phone-7.aspx

    EXAMPLE 7 - How to implement EXAMPLE 1 (tableView:didSelectRowAtIndexPath) possibility maybe not sure recommendations please

    http://stackoverflow.com/questions/4...d-menu-control

    EXAMPLE 8 - For tombstone and memory issues possible data passing methods to consider in case page to page is the only possible way instead of being about to refresh current page

    http://nishantcop.blogspot.com/2011/...n-windows.html

    EXAMPLE 9 - Dynamically changing listbox items

    http://stackoverflow.com/questions/5...ge-dynamically

    EXAMPLE 10 - Dynamically changing the SOURCE of data template

    http://stackoverflow.com/questions/5...a-datatemplate

    EXAMPLE 11 - DIRECTLY data bind the listbox

    http://forums.create.msdn.com/forums/t/73562.aspx

  2. #2
    Registered User
    Join Date
    Nov 2011
    Location
    Manaus, Brazil
    Posts
    5

    Re: Drill down listbox with several detail views for windows phone

    Hello livinglifehappy,

    Just one question, does this XML example come from any service or something like that? It's damn ugly and almost non human readable!

    Anyways, I wrote some code that parses your XML file (I've wrote it really fast, maybe it can be optimized). You XML example was added as a Content file. It is parsing it all corretly. Although it reads a file, you can the XmlReader to get data from Stream, so that shouldn't be a problem.

    Here is the code from the MainPage:
    Code:
    public partial class MainPage : PhoneApplicationPage
        {
            // Constructor
            public MainPage()
            {
                InitializeComponent();
            }
    
            protected override void OnNavigatedTo(System.Windows.Navigation.NavigationEventArgs e)
            {
                base.OnNavigatedTo(e);
                this.ParseXML("Dictionaries.xml");
            }
    
            public class DictBase
            {
                public string Title { get; set; }
                public DictBase Parent { get; set; }
            }
    
            public class DictItem : DictBase
            {
                public List<DictBase> Children { get; set; }
    
                public DictItem()
                {
                    this.Children = new List<DictBase>();
                }
            }
    
            public class DictView : DictBase
            {
                public Dictionary<string, string> Information { get; set; }
    
                public DictView()
                {
                    this.Information = new Dictionary<string, string>();
                }
            }
    
            /// <summary>
            /// Parses your example XML file
            /// </summary>
            /// <param name="xmlFile">The xml filename, included in your WP7 project as "content"</param>
            /// <returns>A root DictItem with everything loaded</returns>
            public DictItem ParseXML(string xmlFile)
            {
                var reader = XmlReader.Create(xmlFile);
                var rootDict = new DictItem { Title = "Rows", Parent = null };
    
                DictItem parentDict = rootDict;
                DictView currentView = null;
                string tempTitle = String.Empty;
                string tempKey = String.Empty;
                bool waitingForTitle = false;
                bool waitingForKey = false;
                bool waitingForInformation = false;
                
                while (reader.Read())
                {
                    switch (reader.NodeType)
                    {
                        case XmlNodeType.Element:
                            
                            if (reader.Name.Equals("key"))
                            {
                                waitingForKey = true;
                            }
                            break;
    
                        case XmlNodeType.EndElement:
    
                            if (reader.Name.Equals("array"))
                            {
                                parentDict = (DictItem)parentDict.Parent;
                            }
                            
                            if (reader.Name.Equals("dict") && currentView != null)
                            {
                                currentView = null;
                            }
    
                            break;
    
                        case XmlNodeType.Text:
    
                            if (waitingForTitle)
                            {
                                waitingForTitle = false;
                                tempTitle = reader.Value;
                            }
    
                            if (waitingForInformation && currentView != null)
                            {
                                waitingForInformation = false;
                                currentView.Information.Add(tempKey, reader.Value);
                            }
    
                            if (waitingForKey)
                            {
                                if (currentView != null)
                                {
                                    waitingForKey = false;
                                    waitingForInformation = true;
                                    tempKey = reader.Value;
                                }
    
                                if (reader.Value.Equals("Title"))
                                {
                                    waitingForKey = false;
                                    waitingForTitle = true;
                                }
    
                                if (reader.Value.Equals("Children"))
                                {
                                    waitingForKey = false;
    
                                    var dictItem = new DictItem { Title = tempTitle, Parent = parentDict };
                                    parentDict.Children.Add(dictItem);
                                    parentDict = dictItem;
                                }
    
                                if (reader.Value.Equals("View"))
                                {
                                    waitingForKey = false;
    
                                    currentView = new DictView { Title = tempTitle, Parent = parentDict };
                                    parentDict.Children.Add(currentView);
                                }
                            }
                            break;
                    }
                }
    
                return rootDict;
            }
        }
    That's all I could do right now, maybe later I can try understanding the rest of the issues, but it's a starting point!

    Best regards,

  3. #3
    Registered User
    Join Date
    Nov 2011
    Posts
    2

    Re: Drill down listbox with several detail views for windows phone

    Thanks for at least trying to understand and for replying.
    The XML file as you mention is dam ugly and non human readable cause its a plist xml, such if you saw the reference to EXAMPLE 1 its not your traditional xml format, thats why it can be used to drill down on information.

    Here is an example XML file that drills down like the pictures below.
    http://sites.google.com/site/mrwindo...data/Data2.xml




    Last edited by livinglifehappy; 2011-11-08 at 03:03.

Similar Threads

  1. listbox with scrolls in views
    By xchewy in forum Symbian User Interface
    Replies: 3
    Last Post: 2008-06-03, 22:12
  2. views are not refereshing/listbox
    By tony.blue in forum Symbian User Interface
    Replies: 2
    Last Post: 2007-10-24, 05:33
  3. Replies: 0
    Last Post: 2006-10-21, 16:12
  4. Switching views on a Dialog-based Views App
    By net314 in forum Symbian User Interface
    Replies: 4
    Last Post: 2003-08-26, 21:05
  5. Replies: 1
    Last Post: 2002-07-16, 06:44

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×