Click here to Skip to main content
16,017,278 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Help, Help, Help. I have read lots of articles (very good articles) on this. I have been at this for 3 days now and just can't figure out what my problem is.

The Problem:
I created a Screen based on a WCF and SilverLight Custom Control. The WCF is working find when I use it on the Edit Detail Screen (it brings back the data). On the same screen, I add the custom control, but the data is not binding. The WCF has a GetGamerProfile(Guid?, userId) method which is used as the datasource for the screen member (left side of screen). I created a query and screen parameter to use for the parameter (userid). This is all working fine, but the custom control binding is not working. I did not tried to bind the image yet, because I couldn't get the simple textbox binding to work. Basically, the Custom Control binding is not working.

XAML Code:
sdk:TabItem Header="Profile" Name="tabItemProfile" DataContext="{Binding Screen.GetGamerProfile}"

TextBox Height="23" HorizontalAlignment="Left" Margin="269,7,0,0" Name="tbxCareer" VerticalAlignment="Top" Width="120" Grid.Column="1" Text="{Binding  
Screen.Career,Mode=TwoWay}"

Note: textbox is part of the TabItem (tabItemProfile)

WCF Code (which is working):
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

using System.ComponentModel.DataAnnotations;
using System.Data.EntityClient;
using System.ServiceModel.DomainServices.Server;
using System.Web.Configuration;
using limitlessData.Implementation;

namespace GamerProfileWCF
public class GamerProfile
{
    [Key]
    public Guid     GamerProfileGUID { get; set; }
    [Key]
    public Guid UserProfileGUID { get; set; }
    public string   Career { get; set; }
    public byte[] AvartarImage { get; set; }
}
    public class GamerProfileWCF : System.ServiceModel.DomainServices.Server.DomainService
    {
        private limitlessDataObjectContext context;

        public limitlessDataObjectContext Context
        {
            get
            {
                if (this.context == null)
                {
                    EntityConnectionStringBuilder builder = new EntityConnectionStringBuilder();
                    builder.Metadata =
                      "res://*/limitlessData.csdl|res://*/limitlessData.ssdl|res://*/limitlessData.msl";
                    builder.Provider = "System.Data.SqlClient";
                    builder.ProviderConnectionString =
                      WebConfigurationManager.ConnectionStrings["limitlessData"].ConnectionString;

                    this.context = new limitlessDataObjectContext(builder.ConnectionString);
                }
                return this.context;
            }
        }
		
        [Query(IsDefault = true)]
        public IQueryable<gamerprofile> GetGamers()
        {
            return this.Context.GAMER_PROFILEs
                .Select(g =>
                    new GamerProfile()
                    {
                        GamerProfileGUID = (Guid)g.gamer_profile_id,
                        UserProfileGUID = (Guid)g.user_profile_id,
                        AvartarImage = (byte[])g.avartar_Image,
                        Career = g.career
                    });
        }

        [Query(IsComposable = false)]
        public IQueryable<gamerprofile> GetGamerProfile(Guid? userID)
        {
            userID = new Guid("7b984d40-48e2-4be1-94ce-5281b4170406");             
            
            return (from userP in this.Context.USER_PROFILEs
                    join gamerP in this.Context.GAMER_PROFILEs on userP.user_profile_id equals gamerP.user_profile_id                  
                    where userP.user_profile_id == userID                   
                     select new GamerProfile()
                     {
                         GamerProfileGUID   = (Guid)gamerP.gamer_profile_id,
                         UserProfileGUID 	= (Guid)userP.user_profile_id,
                         AvartarImage       = (byte[]) gamerP.avartar_Image,
                         Career             = gamerP.career
                     });
        }
    }
}
Posted
Updated 3-Jun-13 9:07am
v2
Comments
SoMad 3-Jun-13 19:41pm    
OP: I got an email stating that richcb updated my question; however, I don't see richcb update.

From what I can see, richcb formatted the source code in your post, making it a lot easier to read. This is pretty normal and not something that was done to offend you, but to help you by having more people look at your question without giving up.

Soren Madsen

1 solution

I got an email stating that richcb updated my question; however, I don't see richcb update.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month


CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900