Note that there are some explanatory texts on larger screens.

plurals
  1. POItemGridView ItemClick on Windows Store App
    primarykey
    data
    text
    <p>I'm on windows 8 store app. In this project. I need to send the data to another page. The plan is, I have a ItemGridView in MainPage.xaml, I click the image of the news, and I need to send the ARTICLE ID of that news to next page and must create a article with that ID.</p> <p>I did this windows phone 8 application with this;</p> <pre><code>private void MainLongListSelectorSelectionChanged(object sender, SelectionChangedEventArgs e) { NavigationService.Navigate( new Uri( "/DetailsPage.xaml?selectedIndex=" + ((MyWebApi.Headline) MainLongListSelector.SelectedItem).ARTICLEID, UriKind.Relative)); } </code></pre> <p>In win store app, I try this ;</p> <pre><code>private void itemGridView_ItemClick(object sender, ItemClickEventArgs e) { this.Frame.Navigate(typeof (BasicPage1), ((MyWebApi.MainPageHeadline) itemGridView.SelectedItem).ARTICLEID); } </code></pre> <p>And I also tried like this;</p> <pre><code>private void itemGridView_ItemClick(object sender, ItemClickEventArgs e) { var articleid = ((MyWebApi.MainPageHeadline) itemGridView.SelectedItem).ARTICLEID; this.Frame.Navigate(typeof (BasicPage1), articleid); } </code></pre> <p>But I get the </p> <blockquote> <p>"<em>Object reference not set to an instance of an object.</em>"</p> </blockquote> <p>at the end of the line.</p> <p>I could not get the value of ID with this. Is there any other suggestion any advice ?</p> <p>Thank you.</p> <p><strong>UPDATE :</strong> </p> <p>This is MainPage.xaml.cs;</p> <pre><code>public sealed partial class MainPage : try012.Common.LayoutAwarePage { private string _json = ""; private MyWebApi.RootObject Headlines { get; set; } public MainPage() { this.InitializeComponent(); } protected override void LoadState(Object navigationParameter, Dictionary&lt;String, Object&gt; pageState) { } protected override void OnNavigatedTo(NavigationEventArgs e) { const string urlt = "MyWebApiURL"; var hWebRequestt = (HttpWebRequest)WebRequest.Create(urlt); hWebRequestt.Method = "GET"; hWebRequestt.BeginGetResponse(MainLongListSelectorLoadCompletedt, hWebRequestt); } private void MainLongListSelectorLoadCompletedt(IAsyncResult ar) { var request = (HttpWebRequest)ar.AsyncState; var response = (HttpWebResponse)request.EndGetResponse(ar); using (var streamReader = new StreamReader(response.GetResponseStream())) { _json = streamReader.ReadToEnd(); Headlines = JsonConvert.DeserializeObject&lt;MyWebApi.RootObject&gt;(_json); } if (Headlines.MainPageHeadline.Count &gt; 0) Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () =&gt; { itemGridView.ItemsSource = Headlines.MainPageHeadline.ToList(); }); } private void itemGridView_ItemClick(object sender, ItemClickEventArgs e) { this.Frame.Navigate(typeof(BasicPage1),((MyWebApi.MainPageHeadline)e.ClickedItem).ARTICLEID); } } </code></pre> <p>And this is BasicPage1.xaml.cs;</p> <pre><code>public sealed partial class BasicPage1 : try012.Common.LayoutAwarePage { public BasicPage1() { this.InitializeComponent(); } protected override void LoadState(Object navigationParameter, Dictionary&lt;String, Object&gt; pageState) { } protected override void SaveState(Dictionary&lt;String, Object&gt; pageState) { } } </code></pre>
    singulars
    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