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

  • SEARCH
  • Home
  • 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 8497407
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T00:07:03+00:00 2026-06-11T00:07:03+00:00

I develop an app for Windows Phone 7 with using of Caliburn Micro and

  • 0

I develop an app for Windows Phone 7 with using of Caliburn Micro and Reactive Extensions.

The app has a page with a ListBox control:

<Grid x:Name="ContentPanel"
          Grid.Row="1"
          Margin="12,0,12,0">
      <ListBox ItemsSource="{Binding Items}">
          <ListBox.ItemTemplate>
              <DataTemplate>
                  <Views:ItemView Margin="0,12,0,0" />
              </DataTemplate>
          </ListBox.ItemTemplate>
      </ListBox>
</Grid>

I’m using the next ItemView as a DataTemplate:

<UserControl ...>
    <Grid x:Name="LayoutRoot"
          cal:Message.Attach="[Event Tap] = [Action SelectItem]">
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="*" />
            <ColumnDefinition Width="Auto" />
        </Grid.ColumnDefinitions>

        <TextBlock Grid.Column="0"
                   Style="{StaticResource PhoneTextLargeStyle}"
                   Text="{Binding Name}"
                   TextWrapping="Wrap" />

        <TextBlock Grid.Column="1"
                   Foreground="{StaticResource PhoneDisabledBrush}"
                   Style="{StaticResource PhoneTextLargeStyle}"
                   Text="{Binding Id}" />
    </Grid>
</UserControl>

And the corresponding ItemViewModel looks like this:

public class ItemViewModel
{
    private readonly INavigationService _navigationService;

    public int Id { get; private set; }

    public string Name { get; private set; }

    public ItemViewModel(Item item)
    {
        Id = item.Id;
        Name = item.Name;

        _navigationService = IoC.Get<INavigationService>();
    }

    public void SelectItem()
    {
        _navigationService.UriFor<MainViewModel>()
            .WithParam(x => x.Id, Id)
            .Navigate();
        }
    }
}

The ListBox populates with items:

public class ListViewModel : Screen
{
    private readonly IItemsManager _itemsManager;

    private List<ItemViewModel> _items;

    public List<ItemViewModel> Items
    {
        get { return _items; }
        private set
        {
            _items = value;
            NotifyOfPropertyChange(() => Items);
        }
    } 

    public ListViewModel(IItemsManager itemsManager)
    {
        _itemsManager = itemsManager;
    }

    protected override void OnViewReady(object view)
    {
        base.OnViewReady(view);           

        Items = null;

        var list = new List<ItemViewModel>();

        _itemsManager.GetAll()
            .SubscribeOn(ThreadPoolScheduler.Instance)
            .ObserveOnDispatcher()
            .Subscribe((item) => list.Add(new ItemViewModel(item)), 
                (ex) => Debug.WriteLine("Error: " + ex.Message), 
                () => 
                    {
                        Items = list;
                        Debug.WriteLine("Completed"));
                    }
    }
}

And here the problems begin.

_itemsManager returns all items correctly. And all items correctly displayed in the ListBox. There is ~150 items.

When I tap on an item then SelectItem method in the corresponding ItemViewModel must be called. And all works fine for first 10-20 items in ListBox. But for all the next items SelectItem method is called in absolutely incorrect ItemViewModel. For example, I tap on item 34 and SelectItem method is called for item 2, I tap 45 – method is called for item 23, and so on. And there is no no dependence between items.

I already head breaks in search of bugs. In what could be the problem?

  • 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-06-11T00:07:04+00:00Added an answer on June 11, 2026 at 12:07 am

    The solution was found after reading the discussion forum and the page in documentation of Caliburn.Micro.
    All problems were because of Caliburn.Micro’s Conventions.

    To solve the problem I’ve added to the DataTempalate the next code: cal:View.Model={Binding}. Now part of the page with the ListBox looks like this:

    <Grid x:Name="ContentPanel"
          Grid.Row="1"
          Margin="12,0,12,0">
        <ListBox ItemsSource="{Binding Items}">
            <ListBox.ItemTemplate>
                <DataTemplate>
                    <Views:ItemView Margin="0,12,0,0" cal:View.Model={Binding}/>
                </DataTemplate>
            </ListBox.ItemTemplate>
        </ListBox>
    </Grid>
    

    I think it’s not a perfect answer. So I’ll be glad if someone can provide better answer and explanation.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm using PhoneGap to develop a Windows Phone 7 app. I'm trying to call
I want to develop an app for windows phone using Phone Gap. The Phone
i want to develop an app for manage the desktop in windows using C#
I am developing a windows phone 7 app. I am using many controls in
i am about to develop a windows phone app that makes use of mspn
I'm currently learning how to develop and building an app for windows phone 7.
I want to develop app for windows phone but I got a big problem,
I have a Windows Phone 7 app to develop as a pet project and
I want to develop an app for my own use only for Windows Phone
I am .NET developer and currently working on App to develop on Windows Phone

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.