Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6979207
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T17:51:24+00:00 2026-05-27T17:51:24+00:00

I’m porting an Android app to wp7 and I’m trying to do things the

  • 0

I’m porting an Android app to wp7 and I’m trying to do things the .net way, and I’m beginning to get my head wrapped around data binding, but I am lost when it comes to a few things.

My classes consist of the following:

  • PickLeaf – the data representation of each item in the list
  • PickLeafModel – the data representation of a collection of PickLeaf objects
  • PickLeafCell – the user control for each item in the list
  • PickLeafListView – derived version of ListBox
  • PickLeafPage – the page that contains the list view and instantiates some of the controller objects and threads
  • IPickLeafListener – an interface that the PickLeafPage implements and allows it to get notified when certain things occur regarding to the PickLeafCell (tap, context menu opened, scroll window changed)

Currently I am adding the PickLeafCell controls dynamically to PickLeafListView.Items, which kind of goes around data binding and perhaps is leading to some of the bugs I am seeing (such as updating it while its being scrolled causes scroll window to go berserk).

QUESTION: If I change it so that the PickLeafModel can be used as a DataSource, how do I pass the IPickLeafListener and PickLeaf references to the PickLeafCell using data binding?

Thanks!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T17:51:24+00:00Added an answer on May 27, 2026 at 5:51 pm

    It’s hard to understand your architecture, but I try.

    First of all, bind your data to ListBox

    listBox.ItemsSource = PickLeafModel;

    Your ListBox should looks like:

     <ListBox x:Name="listBox" ...>
          <ListBox.ItemTemplate>
               <DataTemplate>
                    <my:PickLeafCell DataContext={Binding} TapEvent="Tap" .../>
               </DataTemplate>
          </ListBox.ItemTemplate>
     </ListBox>
    

    Two main thing happen here: PickLeafCell DataContext is bind to your data for each list item. And you subscribe to your PickLeafCell custom events.

    When some event happens in PickLeafCell control, it raised custom event to which your main page is subscribed

     public class PickLeafCell...
     {
          public delegate void TapEventEventHandler(object sender, EventArgs e);
          public event TapEventEventHandler TapEvent;
    
          protected virtual void OnTap(EventArgs e) 
          {
               if (TapEvent != null)
                    TapEvent(this, e);
          }
    

    This is your C# main page code-behind where you have event handlers:

     private Tap(object sender, EventArgs e)
     {
          var item = (sender as FrameworkElement).DataContext as PickLeaf;
     }
    

    And in PickLeafCell control you have DataContext already set to your PickLeaf, so you can easy bind to fields

     <TextBlock Text={Binding SomeFieldOfPickLeaf} />
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

link Im having trouble converting the html entites into html characters, (&# 8217;) i
I am trying to understand how to use SyndicationItem to display feed which is
Basically, what I'm trying to create is a page of div tags, each has
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
We're building an app, our first using Rails 3, and we're having to build
I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
I want to construct a data frame in an Rcpp function, but when I
I'm trying to use string.replace('’','') to replace the dreaded weird single-quote character: ’ (aka
I am writing an app with both english and french support. The app requests

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.