Click here to Skip to main content
15,895,142 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hi,

I have a simple application and I cannot seem to bind a Silverlight 4 combox to a lookup table without a foreign key in VS2010.

I have 2 tables:

tblEmployee
tblState

In the employee table there is a field state. The employee table is the master table and bound to a grid where the user can select an individual employee. There is a detail bound to the employee grid with the individual fields including state. When the application starts "Alabama" is visible in the State Combobox.

The state table is comprised of two fields, the key ID which is a two letter abbrevaiation and Desc with the state name. (I did not create the database, just working with what already exists.)

On my .XAML page I have a detail with the DataContext bound to a grid. When a user selects an Employee all of the bound text and date fields show the employee fields correctly. The combobox just shows "Alabama".

The RIA Code for the State Table is:

<riacontrols:removed autoload="True" d:designdata="{d:DesignInstance my:tblstate, CreateList=true}" height="0" xmlns:d="#unknown" xmlns:riacontrols="#unknown">
LoadedData="tblstateDomainDataSource_LoadedData" Name="tblstateDomainDataSource" QueryName="GetTblstatesQuery" Width="0">
<riacontrols:removed>
<my1:removed xmlns:my1="#unknown">




The xaml for the state combox is:

<removed name="stateComboBox" grid.column="1" grid.row="5">
Height="23" HorizontalAlignment="Right" Margin="0,3,75,3"
VerticalAlignment="Center" Width="92" TabIndex="10"

ItemsSource="{Binding ElementName=tblstateDomainDataSource, Path=Data, Mode=TwoWay}"

SelectedItem="{Binding ElementName=tblstateDomainDataSource, Path=ID, Mode=TwoWay}"

DisplayMemberPath="Desc"


<removed>
Posted

I seem to have made some progress on my own problem. The code below is based on several posting on the silverlight website but I am still having issues with the following:

Any of the following seems to stop the combobox from synchronizing.

1-Sort the grid
2-Select an employee in the grid with a blank or NULL value
3-Change the selection criteria for the grid.

Any help on these issues would be appreciated.



<riacontrols:removed autoload="True" d:designdata="{d:DesignInstance my:tblstate, CreateList=true}" xmlns:d="#unknown" xmlns:riacontrols="#unknown">
Height="100" LoadedData="tblstateDomainDataSource_LoadedData"
Name="tblstateDomainDataSource"
QueryName="GetTblstatesQuery"
Width="100">
<riacontrols:removed>
<my1:removed xmlns:my1="#unknown">


<removed name="stateComboBox" grid.column="1" grid.row="5" height="23" horizontalalignment="Right" verticalalignment="Center" width="92" tabindex="10">
ItemsSource="{Binding BindsDirectlyToSource=True, ElementName=tblstateDomainDataSource, Path=Data, Mode=TwoWay}" Margin="0,3,75,3"
SelectedValuePath="ID"
SelectedValue="{Binding ElementName=grdEmployee, Path=SelectedItem.state, Mode=TwoWay}" DataContext="{Binding}"
DisplayMemberPath="Desc" >


<removed>
 
Share this answer
 
If anyone is interested I purchased the ComponentOne Silverlight components (not cheap) but their combobox in release .73 actually works.
 
Share this answer
 
v2

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



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