Note that there are some explanatory texts on larger screens.

plurals
  1. PObind listbox to selected item
    primarykey
    data
    text
    <p>WP8, VS2012...I'm using msdn Local Database Sample for foundation.</p> <p>Here's my current setup that is 75% there...</p> <p>I have MainPage pivot > listbox AllItems that displays all the current items in the database:</p> <p>XAML</p> <pre><code> &lt;ListBox SelectionChanged="OpenWinePage_Click" x:Name="allItemsListBox" ItemsSource="{Binding AllItems}" Margin="12,2,-20,-2" Width="440" ItemTemplate="{StaticResource WineListBoxItemTemplate}" /&gt; </code></pre> <p><img src="https://i.stack.imgur.com/ITwtz.png" alt="enter image description here"></p> <p>I want to be able to click on one of the items i.e. Mark Ryan and have only that item show up in a Details page:</p> <p>The behind the code OpenWinePage_Click is:</p> <pre><code> private void OpenWinePage_Click(object sender, EventArgs e) { // Capture selected item data _selectedItem = (sender as ListBox).SelectedItem; if (_selectedItem != null) { // Send ID of selected contact string dest = "/WinePage.xaml?toDoItemId=" + ((ToDoItem)_selectedItem).ToDoItemId; NavigationService.Navigate(new Uri(dest, UriKind.Relative)); } } </code></pre> <p>When the WinePage.xaml opens, the xaml to show the selected item is:</p> <pre><code> &lt;ListBox x:Name="WinePageDetails" Margin="12, 0, 12, 0" Width="440" ItemsSource="{Binding AllItems}" &lt;!--I DON'T KNOW WHAT TO BIND HERE TO ONLY SHOW SELECTED ITEM--&gt; ItemTemplate="{StaticResource WinePageListBoxItemTemplate}" /&gt; </code></pre> <p>So I get all of the items in the details page, not just the 1 selected item:</p> <p><img src="https://i.stack.imgur.com/3v9An.png" alt="enter image description here"></p> <p>In my ToDoViewModel.cs I have the following to which I am trying to bind?...</p> <pre><code> // All items. private ObservableCollection&lt;ToDoItem&gt; _allItems; public ObservableCollection&lt;ToDoItem&gt; AllItems { get { return _allItems; } set { _allItems = value; NotifyPropertyChanged("AllItems"); } } // To-do items associated with the red category. private ObservableCollection&lt;ToDoItem&gt; _redItems; public ObservableCollection&lt;ToDoItem&gt; RedItems { get { return _redItems; } set { _redItems = value; NotifyPropertyChanged("RedItems"); } }...et al pivots </code></pre> <p>Do I need to create another observable collection that points to just one item so I can bind to it?</p> <p>Is this a binding issue? A database issue? How do I get just one selected item to show up on my details page?</p> <p>Many Thanks for any help!</p> <p>R</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload