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 8943813
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T11:52:48+00:00 2026-06-15T11:52:48+00:00

Silverlight newbie here, trying to do a simple databinding: Im trying to get a

  • 0

Silverlight newbie here, trying to do a simple databinding:

Im trying to get a list of all users in a test db, but i cant;
Im using Openaccess and followed all tutorials on how to create a Domain Model, then a Domain Service;
Im having problems executing the following code, which returns always 0 even though i have 200 lines on db:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using System.ServiceModel.DomainServices.Client;
using SLTest.Web;

namespace SLTest {
    public partial class MainPage : UserControl  {

        private TestDomainContext link = new TestDomainContext();



        public MainPage() {
            InitializeComponent();
            Loaded += new RoutedEventHandler(MainPage_Loaded);
        }

        private void MainPage_Loaded(object sender, RoutedEventArgs e) {

            int count = 0;
            LoadOperation<DomainUser> loadOperation = link.Load(link.GetDomainUsersQuery());
            loadOperation.Completed += (s, a) =>{
                theList.ItemsSource = link.DomainUsers;
                count = link.DomainUsers.Count();
            };

        }
    }
}

Also, why is that simply doing

int count = link.DomainUsers.Count();

doesnt work as it does in ASP.NET?

Here is the XAML:

<UserControl x:Class="SLTest.MainPage"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
        xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation"
        mc:Ignorable="d" d:DesignWidth="640" d:DesignHeight="480">

    <Grid x:Name="theGrid">
        <Grid.RowDefinitions>
            <RowDefinition Height="auto"></RowDefinition>
        </Grid.RowDefinitions>
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="200"></ColumnDefinition>
            <ColumnDefinition Width="*"></ColumnDefinition>
        </Grid.ColumnDefinitions>
        <ListBox Grid.Row="0" Grid.Column="0" x:Name="theList">
            <DataTemplate>
                <TextBlock Text="{Binding FullName}"></TextBlock>
            </DataTemplate>
        </ListBox>
    </Grid>
</UserControl>
  • 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-15T11:52:50+00:00Added an answer on June 15, 2026 at 11:52 am

    I am guessing that the link object is your actual domain service and as such you should not be addressing it directly in the callback method as all query operations in your service are asynchronous and will not yield any result of addressed that way.
    Instead you can use the asynchronous callback methods arguments to get the information you are requesting like that:

      loadOperation.Completed += (s, a) =>
            {
                LoadOperation<DomainUser> loadedObjects = (LoadOperation<DomainUser>)s;
                theList = loadedObjects.Entities;
                count = loadedObjects.Entities.Count();
            };
    

    That should work.

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

Sidebar

Related Questions

Silverlight newbie here, so I apologize if this question isn't even worded correctly. I
I've been trying to find a good advanced Silverlight 4 course, but can't really
Newbie question... I am using silverlight to POST data to my GAE application class
I'm sure that this is a simple newbie question, but the answer is eluding
I am complete newbie to Silverlight and the WCF platform. I want to get
I am a newbie in this Silverlight Databinding subject. I am starting to understand
I am Silverlight newbie and I can't make the simple Silverlight binding sample work!
I'm trying to make a simple Windows Phone 7 Silverlight app. There's the MainPage.xaml
In Silverlight, how can I test in a simple if/then if a RadioButton is
[unit testing newbie] [c#] Consider the following scenario: I'm using Silverlight and calling a

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.